function AbstractTransport::send
Overrides TransportInterface::send
4 calls to AbstractTransport::send()
- SendmailTransport::send in vendor/
symfony/ mailer/ Transport/ SendmailTransport.php - SendmailTransport::send in vendor/
symfony/ mailer/ Transport/ SendmailTransport.php - SmtpTransport::send in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php - SmtpTransport::send in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php
2 methods override AbstractTransport::send()
- SendmailTransport::send in vendor/
symfony/ mailer/ Transport/ SendmailTransport.php - SmtpTransport::send in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php
File
-
vendor/
symfony/ mailer/ Transport/ AbstractTransport.php, line 61
Class
- AbstractTransport
- @author Fabien Potencier <fabien@symfony.com>
Namespace
Symfony\Component\Mailer\TransportCode
public function send(RawMessage $message, ?Envelope $envelope = null) : ?SentMessage {
$message = clone $message;
$envelope = null !== $envelope ? clone $envelope : Envelope::create($message);
try {
if (!$this->dispatcher) {
$sentMessage = new SentMessage($message, $envelope);
$this->doSend($sentMessage);
return $sentMessage;
}
$event = new MessageEvent($message, $envelope, (string) $this);
$this->dispatcher
->dispatch($event);
if ($event->isRejected()) {
return null;
}
$envelope = $event->getEnvelope();
$message = $event->getMessage();
if ($message instanceof TemplatedEmail && !$message->isRendered()) {
throw new LogicException(\sprintf('You must configure a "%s" when a "%s" instance has a text or HTML template set.', BodyRendererInterface::class, get_debug_type($message)));
}
$sentMessage = new SentMessage($message, $envelope);
try {
$this->doSend($sentMessage);
} catch (\Throwable $error) {
$this->dispatcher
->dispatch(new FailedMessageEvent($message, $error));
$this->checkThrottling();
throw $error;
}
$this->dispatcher
->dispatch(new SentMessageEvent($sentMessage));
return $sentMessage;
} finally {
$this->checkThrottling();
}
}