<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
CRM_Utils_Hook::alterMailParams($params);
// check if any module has aborted mail sending
- if (CRM_Utils_Array::value('abortMailSend', $params) ||
+ if (
+ CRM_Utils_Array::value('abortMailSend', $params) ||
!CRM_Utils_Array::value('toEmail', $params)
) {
return FALSE;
$headers = array_merge($headers, $params['headers']);
}
$headers['From'] = $params['from'];
- $headers['To'] = self::formatRFC822Email(CRM_Utils_Array::value('toName', $params),
- CRM_Utils_Array::value('toEmail', $params),
- FALSE
- );
+ $headers['To'] =
+ self::formatRFC822Email(
+ CRM_Utils_Array::value('toName', $params),
+ CRM_Utils_Array::value('toEmail', $params),
+ FALSE
+ );
$headers['Cc'] = CRM_Utils_Array::value('cc', $params);
$headers['Bcc'] = CRM_Utils_Array::value('bcc', $params);
$headers['Subject'] = CRM_Utils_Array::value('subject', $params);
$headers['Content-Disposition'] = 'inline';
$headers['Content-Transfer-Encoding'] = '8bit';
$headers['Return-Path'] = CRM_Utils_Array::value('returnPath', $params);
+
// CRM-11295: Omit reply-to headers if empty; this avoids issues with overzealous mailservers
$replyTo = CRM_Utils_Array::value('replyTo', $params, $from);
+
if (!empty($replyTo)) {
$headers['Reply-To'] = $replyTo;
}
$headers = &$msg->headers($headers);
$to = array($params['toEmail']);
-
- //get emails from headers, since these are
- //combination of name and email addresses.
- if (CRM_Utils_Array::value('Cc', $headers)) {
- $to[] = CRM_Utils_Array::value('Cc', $headers);
- }
- if (CRM_Utils_Array::value('Bcc', $headers)) {
- $to[] = CRM_Utils_Array::value('Bcc', $headers);
- unset($headers['Bcc']);
+ $result = null;
+ $mailer =& CRM_Core_Config::getMailer( );
+
+ // Mail_smtp and Mail_sendmail mailers require Bcc anc Cc emails
+ // be included in both $to and $headers['Cc', 'Bcc']
+ if (get_class($mailer) != "Mail_mail") {
+ //get emails from headers, since these are
+ //combination of name and email addresses.
+ if ( CRM_Utils_Array::value( 'Cc', $headers ) ) {
+ $to[] = CRM_Utils_Array::value( 'Cc', $headers );
+ }
+ if ( CRM_Utils_Array::value( 'Bcc', $headers ) ) {
+ $to[] = CRM_Utils_Array::value( 'Bcc', $headers );
+ }
}
-
- $result = NULL;
- $mailer = CRM_Core_Config::getMailer();
- CRM_Core_Error::ignoreException();
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$result = $mailer->send($to, $headers, $message);
CRM_Core_Error::setCallback();
if (is_a($result, 'PEAR_Error')) {
$message = self::errorMessage($mailer, $result);
// append error message in case multiple calls are being made to
// this method in the course of sending a batch of messages.
- CRM_Core_Session::setStatus(ts($message), ts('Mailing Error'), 'error');
+ CRM_Core_Session::setStatus($message, ts('Mailing Error'), 'error');
return FALSE;
}
// CRM-10699
}
$message .= '<li>' . ts('The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.') . '</li>' . '</ul>' . '<p>' . ts('Check <a href="%1">this page</a> for more information.', array(
- 1 => CRM_Utils_System::docURL2('user/initial-set-up/email-system-configuration', TRUE))) . '</p>';
+ 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE))) . '</p>';
return $message;
}