[Mailer] Fix Message ID for Postmark SMTP
This commit is contained in:
parent
b42c269760
commit
d97d1f9bb4
@ -68,7 +68,7 @@ class MailgunApiTransport extends AbstractApiTransport
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result, $response->getStatusCode()), $response);
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
$sentMessage->setMessageId($result['id']);
|
||||
|
@ -70,7 +70,7 @@ class MailgunHttpTransport extends AbstractHttpTransport
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result['message'], $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result, $response->getStatusCode()), $response);
|
||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $response->getContent(false), $response->getStatusCode()), $response);
|
||||
}
|
||||
|
||||
$message->setMessageId($result['id']);
|
||||
|
@ -12,7 +12,11 @@
|
||||
namespace Symfony\Component\Mailer\Bridge\Postmark\Transport;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Mailer\Envelope;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
|
||||
use Symfony\Component\Mime\Message;
|
||||
use Symfony\Component\Mime\RawMessage;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
@ -27,4 +31,13 @@ class PostmarkSmtpTransport extends EsmtpTransport
|
||||
$this->setUsername($id);
|
||||
$this->setPassword($id);
|
||||
}
|
||||
|
||||
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
|
||||
{
|
||||
if ($message instanceof Message) {
|
||||
$message->getHeaders()->addTextHeader('X-PM-KeepID', 'true');
|
||||
}
|
||||
|
||||
return parent::send($message, $envelope);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user