Created
April 5, 2019 14:56
-
-
Save romaricdrigon/9216cb982b7f95bde0c18898fea99745 to your computer and use it in GitHub Desktop.
Preview des composants Mime et Mailer de Symfony
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% block subject %}Ce week-end{% endblock %} | |
{% block html %} | |
Bonjour,<br /> | |
<p> | |
Chers collègues de <a href="http://netinfluence.ch">netinfluence</a>, fait-on une <em>fondue</em> ce week-end? | |
</p> | |
Romaric | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$email = (new TemplatedEmail()) | |
->from('[email protected]') | |
->to('[email protected]') | |
->template('exemple.email.twig') | |
; | |
$transport = Transport::fromDsn('smtp://docker.for.mac.localhost:1025'); | |
$mailer = new Mailer($transport); | |
// Ce code de "glue" ne sera pas nécessaire une fois le composant intégré dans SF | |
$renderer = new BodyRenderer($twig); | |
$renderer->render($email); | |
$mailer->send($email); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment