symfony - link in body of Email Symfony2 -


i want send in body of email link, have in controller .

 $message = \swift_message::newinstance()                                     ->setsubject('demande de conge ')                                     ->setfrom($col->getemailcollaborateur())                                     ->setto($form->get("emailcdp")->getdata())                                     ->setbody($this->render('mytestbundle:conge:demandecongenormal.html.twig', array('conge' => $conge)))                                     ;                                     $this->get('mailer')->send($message); 

in demandecongenormal.html.twig:

  <a href={{ conge.justificatif}}>confirmer</a> 

in email receive have :

  <a href=lllllllll>confirmer</a> 

i'm new in symfony please help!

you should use url function in twig template. example:

<a href="{{ url('_your_route_name_to_active', {'route_parameter': 'route_parameter_value'}) }}">activate</a> 

_your_route_name_to_active defined route app/config/routing.yml or acmebundle/resources/config/routing.yml

example:

_acmebundle_signup_confirm:     pattern:  /confirm/{user}     defaults: { _controller: acmebundle:index:confirm }     requirements:         user:  \d+ 

where route_parameter equals user parameter in requirements.

for more information routing, please read: http://symfony.com/doc/current/book/routing.html


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -