comparison core/lib/Drupal/Core/Mail/MailManager.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
1 <?php 1 <?php
2 2
3 namespace Drupal\Core\Mail; 3 namespace Drupal\Core\Mail;
4 4
5 use Drupal\Component\Render\PlainTextOutput; 5 use Drupal\Component\Render\PlainTextOutput;
6 use Drupal\Component\Utility\Unicode;
6 use Drupal\Core\Logger\LoggerChannelFactoryInterface; 7 use Drupal\Core\Logger\LoggerChannelFactoryInterface;
7 use Drupal\Core\Plugin\DefaultPluginManager; 8 use Drupal\Core\Plugin\DefaultPluginManager;
8 use Drupal\Core\Cache\CacheBackendInterface; 9 use Drupal\Core\Cache\CacheBackendInterface;
9 use Drupal\Core\Extension\ModuleHandlerInterface; 10 use Drupal\Core\Extension\ModuleHandlerInterface;
10 use Drupal\Core\Config\ConfigFactoryInterface; 11 use Drupal\Core\Config\ConfigFactoryInterface;
246 ]; 247 ];
247 // To prevent email from looking like spam, the addresses in the Sender and 248 // To prevent email from looking like spam, the addresses in the Sender and
248 // Return-Path headers should have a domain authorized to use the 249 // Return-Path headers should have a domain authorized to use the
249 // originating SMTP server. 250 // originating SMTP server.
250 $headers['Sender'] = $headers['Return-Path'] = $site_mail; 251 $headers['Sender'] = $headers['Return-Path'] = $site_mail;
251 $headers['From'] = $site_config->get('name') . ' <' . $site_mail . '>'; 252 // Headers are usually encoded in the mail plugin that implements
253 // \Drupal\Core\Mail\MailInterface::mail(), for example,
254 // \Drupal\Core\Mail\Plugin\Mail\PhpMail::mail(). The site name must be
255 // encoded here to prevent mail plugins from encoding the email address,
256 // which would break the header.
257 $headers['From'] = Unicode::mimeHeaderEncode($site_config->get('name'), TRUE) . ' <' . $site_mail . '>';
252 if ($reply) { 258 if ($reply) {
253 $headers['Reply-to'] = $reply; 259 $headers['Reply-to'] = $reply;
254 } 260 }
255 $message['headers'] = $headers; 261 $message['headers'] = $headers;
256 262