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
Post a Comment