From: Matthew Wire Date: Sun, 17 Dec 2017 09:56:00 +0000 (+0900) Subject: Disable sending email receipt from logged in contact ID / activity source contact X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c981f371a6602cdfcda525895e0d0c40e9294d9;p=civicrm-core.git Disable sending email receipt from logged in contact ID / activity source contact --- diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 5daee0cb33..ed31f325a3 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -3196,7 +3196,9 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')'; public static function getReceiptFrom($activityID) { $name = $address = NULL; - if (!empty($activityID)) { + if (!empty($activityID) && (Civi::settings()->get('allow_mail_from_logged_in_contact'))) { + // This breaks SPF/DMARC if email is sent from an email address that the server is not authorised to send from. + // so we can disable this behaviour with the "allow_mail_from_logged_in_contact" setting. // There is always a 'Added by' contact for a activity, // so we can safely use ActivityContact.Getvalue API $sourceContactId = civicrm_api3('ActivityContact', 'getvalue', array( diff --git a/CRM/Core/BAO/Domain.php b/CRM/Core/BAO/Domain.php index 85235802de..9994323a7d 100644 --- a/CRM/Core/BAO/Domain.php +++ b/CRM/Core/BAO/Domain.php @@ -303,9 +303,14 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain { if (!empty($domain['domain_email'])) { return array($domain['name'], $domain['domain_email']); } - $userID = CRM_Core_Session::singleton()->getLoggedInContactID(); $userName = ''; $userEmail = ''; + + if (!Civi::settings()->get('allow_mail_from_logged_in_contact')) { + return array($userName, $userEmail); + } + + $userID = CRM_Core_Session::singleton()->getLoggedInContactID(); if (!empty($userID)) { list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID); }