Last active
April 21, 2020 10:39
-
-
Save romainnorberg/037dd9860079354954e10606d09b429b to your computer and use it in GitHub Desktop.
This file contains 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
use Symfony\Component\Mailer\Mailer; | |
use Symfony\Component\Mailer\Transport; | |
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; | |
use Symfony\Component\Mime\Email; | |
// not work | |
/* | |
$mailer = new Mailer( | |
Transport::fromDsn( | |
'smtp://127.0.0.1:2525?encryption=tls&auth_mode=login&username=Mailbox-Name&password=dqsqds' | |
) | |
); | |
*/ | |
// work | |
$transport = new EsmtpTransport('127.0.0.1', 2525); | |
$transport->setUsername('Mailbox-Name'); | |
$transport->setPassword(''); | |
$mailer = new Mailer($transport); | |
// ----- | |
$email = (new Email()) | |
->from('[email protected]') | |
->to('[email protected]') | |
->subject('Time for Symfony Mailer!') | |
->text('Sending emails is fun again!') | |
->html('<p>See Twig integration for better HTML integration!</p>'); | |
$mailer->send($email); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment