Commit 576fcb9c authored by eileen's avatar eileen

Towards CRM-17753 - consolidate code location for do-not-reply@emaildomain.com

parent c8989241
......@@ -586,7 +586,7 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )";
$toName = CRM_Contact_BAO_Contact::displayName($params['contactId']);
$replyTo = "do-not-reply@$emailDomain";
$replyTo = CRM_Core_BAO_Domain::getNoReplyEmailAddress();
// set additional general message template params (custom tokens to use in email msg templates)
// tokens then available in msg template as {$petition.title}, etc
......
......@@ -319,4 +319,12 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
return array($userName, $userEmail);
}
/**
* Get address to be used for system from addresses when a reply is not expected.
*/
public static function getNoReplyEmailAddress() {
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
return "do-not-reply@$emailDomain";
}
}
......@@ -118,8 +118,6 @@ class CRM_Mailing_Event_BAO_Confirm extends CRM_Mailing_Event_DAO_Confirm {
$component->find(TRUE);
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$html = $component->body_html;
if ($component->body_text) {
......@@ -143,11 +141,11 @@ class CRM_Mailing_Event_BAO_Confirm extends CRM_Mailing_Event_DAO_Confirm {
$mailParams = array(
'groupName' => 'Mailing Event ' . $component->component_type,
'subject' => $component->subject,
'from' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
'from' => "\"$domainEmailName\" <" . CRM_Core_BAO_Domain::getNoReplyEmailAddress() . '>',
'toEmail' => $email,
'toName' => $display_name,
'replyTo' => "do-not-reply@$emailDomain",
'returnPath' => "do-not-reply@$emailDomain",
'replyTo' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
'returnPath' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
'html' => $html,
'text' => $text,
);
......
......@@ -173,8 +173,6 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply {
}
}
else {
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
if (empty($eq->display_name)) {
$from = $eq->email;
}
......@@ -189,7 +187,7 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply {
'To' => $mailing->replyto_email,
'From' => $from,
'Reply-To' => empty($replyto) ? $eq->email : $replyto,
'Return-Path' => "do-not-reply@{$emailDomain}",
'Return-Path' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
// CRM-17754 Include re-sent headers to indicate that we have forwarded on the email
'Resent-From' => $domainValues['values'][0]['from_email'],
'Resent-Date' => date('r'),
......@@ -253,14 +251,12 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply {
$domain = CRM_Core_BAO_Domain::getDomain();
list($domainEmailName, $_) = CRM_Core_BAO_Domain::getNameAndEmail();
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$headers = array(
'Subject' => $component->subject,
'To' => $to,
'From' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
'Reply-To' => "do-not-reply@$emailDomain",
'Return-Path' => "do-not-reply@$emailDomain",
'From' => "\"$domainEmailName\" <" . CRM_Core_BAO_Domain::getNoReplyEmailAddress() . '>',
'Reply-To' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
'Return-Path' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
);
// TODO: do we need reply tokens?
......
......@@ -267,14 +267,12 @@ class CRM_Mailing_Event_BAO_Resubscribe {
$message->setTxtBody($text);
}
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$headers = array(
'Subject' => $component->subject,
'From' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
'From' => "\"$domainEmailName\" <" . CRM_Core_BAO_Domain::getNoReplyEmailAddress() . '>',
'To' => $eq->email,
'Reply-To' => "do-not-reply@$emailDomain",
'Return-Path' => "do-not-reply@$emailDomain",
'Reply-To' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
'Return-Path' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
);
CRM_Mailing_BAO_Mailing::addMessageIdHeader($headers, 'e', $job, $queue_id, $eq->hash);
$b = CRM_Utils_Mail::setMimeParams($message);
......
......@@ -227,7 +227,7 @@ SELECT civicrm_email.id as email_id
'From' => "\"{$domainEmailName}\" <{$domainEmailAddress}>",
'To' => $email,
'Reply-To' => $confirm,
'Return-Path' => "do-not-reply@$emailDomain",
'Return-Path' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
);
$url = CRM_Utils_System::url('civicrm/mailing/confirm',
......
......@@ -418,10 +418,10 @@ WHERE email = %2
$headers = array(
'Subject' => $component->subject,
'From' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
'From' => "\"$domainEmailName\" <" . CRM_Core_BAO_Domain::getNoReplyEmailAddress() . '>',
'To' => $eq->email,
'Reply-To' => "do-not-reply@$emailDomain",
'Return-Path' => "do-not-reply@$emailDomain",
'Reply-To' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
'Return-Path' => CRM_Core_BAO_Domain::getNoReplyEmailAddress(),
);
CRM_Mailing_BAO_Mailing::addMessageIdHeader($headers, 'u', $job, $queue_id, $eq->hash);
......
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