From 91da5f05e4226cd65d11b1aed9ba37defa9f6672 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 24 Apr 2007 19:49:01 +0000 Subject: - Patch #133789 by John Albin: Drupal-generated email can look like spam. --- includes/common.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index d59e864a9..7ca504bc1 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1969,8 +1969,15 @@ function drupal_mail($mailkey, $to, $subject, $body, $from = NULL, $headers = ar 'Content-Transfer-Encoding' => '8Bit', 'X-Mailer' => 'Drupal' ); - if (isset($from)) { - $defaults['From'] = $defaults['Reply-To'] = $defaults['Return-Path'] = $defaults['Errors-To'] = $from; + // To prevent e-mail from looking like spam, the addresses in the Sender and + // Return-Path headers should have a domain authorized to use the originating + // SMTP server. Errors-To is redundant, but shouldn't hurt. + $default_from = variable_get('site_mail', ini_get('sendmail_from')); + if ($default_from) { + $defaults['From'] = $defaults['Reply-To'] = $defaults['Sender'] = $defaults['Return-Path'] = $defaults['Errors-To'] = $default_from; + } + if ($from) { + $defaults['From'] = $defaults['Reply-To'] = $from } $headers = array_merge($defaults, $headers); -- cgit v1.2.3