-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Description
Symfony version(s) affected: 4.4.8
Description
Sending emails with the Mandrill (MailChimp) API doesn't work when using named addresses for from options. With #33993 setting address is fixed for api /api/1.0/messages/send.json but my mails are send via MandrillHttpTransport::doSendHttp() which will use /api/1.0/messages/send-raw.json. here we still set wrong from_email. More docs about send-raw are on mandrill see https://mandrillapp.com/api/docs/messages.curl.html#method-send-raw
How to reproduce
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mailer\Transport;
$transport = Transport::fromDsn(sprintf('api://%s@mandrill', 'YOUR_KEY'));
$mailer = new Mailer($transport);
$email = new TemplatedEmail();
$email
->from(new Address('test@example.com', 'My Name'))
->subject('Subject')
->text('Message')
->to(
new Address('recipient@example.com', 'Recipient Name')
)
;
$mailer->send($email);
Possible Solution
The solution that was done for send will also apply for send-raw see #33993
Let me know if i should make a pull request to fix this.