Closed
Description
Symfony version(s) affected: 4.3.3
Description
Method Symfony\Component\Mailer\Transport\AbstractTransport::send
, implementation of Symfony\Component\Mailer\MailerInterface::send(RawMessage $message, SmtpEnvelope $envelope = null)
accepts Symfony\Component\Mime\RawMessage
, but by default (when $envelope
is null) creates Symfony\Component\Mailer\DelayedSmtpEnvelope
, which accepts Symfony\Component\Mime\Message
. So when I use a smtp transport, I cannot call Symfony\Component\Mailer\MailerInterface::send()
with a RawMessage
even though the type seems to allow it.
How to reproduce
/**
* @var MailerInterface
*/
private $mailer;
method() {
$this->mailer->send(new RawMessage('content')); // Argument 1 passed to Symfony\Component\Mailer\DelayedSmtpEnvelope::__construct() must be an instance of Symfony\Component\Mime\Message, instance of Symfony\Component\Mime\RawMessage given, called in /var/php/prod/vendor/symfony/mailer/Transport/AbstractTransport.php on line 66
}
Possible Solution
Additional context