function SendmailTransport::__construct
Constructor.
Supported modes are -bs and -t, with any additional flags desired.
The recommended mode is "-bs" since it is interactive and failure notifications are hence possible. Note that the -t mode does not support error reporting and does not support Bcc properly (the Bcc headers are not removed).
If using -t mode, you are strongly advised to include -oi or -i in the flags (like /usr/sbin/sendmail -oi -t)
-f<sender> flag will be appended automatically if one is not present.
Overrides AbstractTransport::__construct
File
-
vendor/
symfony/ mailer/ Transport/ SendmailTransport.php, line 52
Class
- SendmailTransport
- SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary.
Namespace
Symfony\Component\Mailer\TransportCode
public function __construct(?string $command = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null) {
parent::__construct($dispatcher, $logger);
if (null !== $command) {
if (!str_contains($command, ' -bs') && !str_contains($command, ' -t')) {
throw new \InvalidArgumentException(\sprintf('Unsupported sendmail command flags "%s"; must be one of "-bs" or "-t" but can include additional flags.', $command));
}
$this->command = $command;
}
$this->stream = new ProcessStream();
if (str_contains($this->command, ' -bs')) {
$this->stream
->setCommand($this->command);
$this->stream
->setInteractive(true);
$this->transport = new SmtpTransport($this->stream, $dispatcher, $logger);
}
}