Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mailer] Invalid Mandrill send raw api with named addresses  #36879

Closed
@JohJohan

Description

@JohJohan

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('[email protected]', 'My Name'))
    ->subject('Subject')
    ->text('Message')
    ->to(
        new Address('[email protected]', '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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions