Commit 58e1c825 authored by Peter Epp's avatar Peter Epp Committed by Jakob P
Browse files

Issue #3304449 by teknocat: Error sending e-mail from Sender Name <some@email.com>

parent ab3c6404
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -276,15 +276,12 @@ class SMTPMailSystem implements MailInterface, ContainerFactoryPluginInterface {
      $from = $this->configFactory->get('system.site')->get('mail');
    }

    if (empty($from)) {
      $from = $message['from'];
    // The $from address might contain the "name" part. If it does, split it,
    // since PHPMailer expects $from to be the raw email address.
    $matches = [];
    if (preg_match('/^(.*)\s\<(.*)\>$/', $from, $matches)) {
      $from = $matches[2];
    }
    }

    // Updates $headers fields.
    $headers['sender'] = $from;