Commit 035a159a authored by Monish Deb's avatar Monish Deb

Merge pull request #7970 from otetard/CRM-18235

CRM-18235: Allow to define `returnPath` in `CRM_Utils_Mail::send()`.
parents fa843793 e633aba2
......@@ -155,14 +155,13 @@ class CRM_Utils_Mail {
* TRUE if a mail was sent, else FALSE.
*/
public static function send(&$params) {
$returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$defaultReturnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$includeMessageId = CRM_Core_BAO_MailSettings::includeMessageId();
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$from = CRM_Utils_Array::value('from', $params);
if (!$returnPath) {
$returnPath = self::pluckEmailFromHeader($from);
if (!$defaultReturnPath) {
$defaultReturnPath = self::pluckEmailFromHeader($from);
}
$params['returnPath'] = $returnPath;
// first call the mail alter hook
CRM_Utils_Hook::alterMailParams($params);
......@@ -198,7 +197,7 @@ class CRM_Utils_Mail {
$headers['Content-Type'] = $htmlMessage ? 'multipart/mixed; charset=utf-8' : 'text/plain; charset=utf-8';
$headers['Content-Disposition'] = 'inline';
$headers['Content-Transfer-Encoding'] = '8bit';
$headers['Return-Path'] = CRM_Utils_Array::value('returnPath', $params);
$headers['Return-Path'] = CRM_Utils_Array::value('returnPath', $params, $defaultReturnPath);
// CRM-11295: Omit reply-to headers if empty; this avoids issues with overzealous mailservers
$replyTo = CRM_Utils_Array::value('replyTo', $params, CRM_Utils_Array::value('from', $params));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment