diff options
Diffstat (limited to 'lib/private/Mail/Mailer.php')
-rw-r--r-- | lib/private/Mail/Mailer.php | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 05ef0bf5139..5d838b2cdf1 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -57,7 +57,6 @@ use Symfony\Component\Mailer\Transport\SendmailTransport; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream; use Symfony\Component\Mime\Email; -use Symfony\Component\Mime\Exception\InvalidArgumentException; use Symfony\Component\Mime\Exception\RfcComplianceException; /** @@ -110,7 +109,7 @@ class Mailer implements IMailer { * @return Message */ public function createMessage(): Message { - $plainTextOnly = $this->config->getSystemValue('mail_send_plaintext_only', false); + $plainTextOnly = $this->config->getSystemValueBool('mail_send_plaintext_only', false); return new Message(new Email(), $plainTextOnly); } @@ -144,7 +143,7 @@ class Mailer implements IMailer { * @since 12.0.0 */ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate { - $class = $this->config->getSystemValue('mail_template_class', ''); + $class = $this->config->getSystemValueString('mail_template_class', ''); if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) { return new $class( @@ -176,10 +175,10 @@ class Mailer implements IMailer { * @return string[] $failedRecipients */ public function send(IMessage $message): array { - $debugMode = $this->config->getSystemValue('mail_smtpdebug', false); + $debugMode = $this->config->getSystemValueBool('mail_smtpdebug', false); if (!($message instanceof Message)) { - throw new InvalidArgumentException('Object not of type ' . Message::class); + throw new \InvalidArgumentException('Object not of type ' . Message::class); } if (empty($message->getFrom())) { @@ -192,7 +191,7 @@ class Mailer implements IMailer { try { $message->setRecipients(); - } catch (InvalidArgumentException|RfcComplianceException $e) { + } catch (\InvalidArgumentException|RfcComplianceException $e) { $logMessage = sprintf( 'Could not send mail to "%s" with subject "%s" as validation for address failed', print_r(array_merge($message->getTo(), $message->getCc(), $message->getBcc()), true), @@ -267,7 +266,7 @@ class Mailer implements IMailer { $transport = null; - switch ($this->config->getSystemValue('mail_smtpmode', 'smtp')) { + switch ($this->config->getSystemValueString('mail_smtpmode', 'smtp')) { case 'sendmail': $transport = $this->getSendMailInstance(); break; @@ -294,7 +293,7 @@ class Mailer implements IMailer { $mailSmtpsecure = ($this->config->getSystemValue('mail_smtpsecure', null) === 'ssl') ? true : null; $transport = new EsmtpTransport( $this->config->getSystemValue('mail_smtphost', '127.0.0.1'), - (int)$this->config->getSystemValue('mail_smtpport', 25), + $this->config->getSystemValueInt('mail_smtpport', 25), $mailSmtpsecure, null, $this->logger @@ -304,7 +303,7 @@ class Mailer implements IMailer { /** @psalm-suppress InternalMethod */ $stream->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10)); - if ($this->config->getSystemValue('mail_smtpauth', false)) { + if ($this->config->getSystemValueBool('mail_smtpauth', false)) { $transport->setUsername($this->config->getSystemValue('mail_smtpname', '')); $transport->setPassword($this->config->getSystemValue('mail_smtppassword', '')); } @@ -338,7 +337,7 @@ class Mailer implements IMailer { * @return SendmailTransport */ protected function getSendMailInstance(): SendmailTransport { - switch ($this->config->getSystemValue('mail_smtpmode', 'smtp')) { + switch ($this->config->getSystemValueString('mail_smtpmode', 'smtp')) { case 'qmail': $binaryPath = '/var/qmail/bin/sendmail'; break; @@ -351,7 +350,7 @@ class Mailer implements IMailer { break; } - switch ($this->config->getSystemValue('mail_sendmailmode', 'smtp')) { + switch ($this->config->getSystemValueString('mail_sendmailmode', 'smtp')) { case 'pipe': $binaryParam = ' -t'; break; |