Skip to content

Commit

Permalink
Disable sending from logged in contact ID / user email for 'Tell a Fr…
Browse files Browse the repository at this point in the history
…iend'
  • Loading branch information
mattwire committed Jul 14, 2018
1 parent e3556f3 commit 14065de
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CRM/Friend/BAO/Friend.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ public static function create(&$params) {
$mailParams['message'] = CRM_Utils_Array::value('suggested_message', $params);

// Default "from email address" is default domain address.
// This is normally overridden by one of the if statements below
list($_, $mailParams['email_from']) = CRM_Core_BAO_Domain::getNameAndEmail();
list($username, $mailParams['domain']) = explode('@', $mailParams['email_from']);

Expand Down Expand Up @@ -218,9 +217,11 @@ public static function create(&$params) {
$mailParams['module'] = 'event';
}
elseif ($params['entity_table'] == 'civicrm_pcp') {
$mailParams['email_from'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $params['source_contact_id'],
'email', 'contact_id'
);
if (Civi::settings()->get('allow_mail_from_logged_in_contact')) {
$mailParams['email_from'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $params['source_contact_id'],
'email', 'contact_id'
);
}
$urlPath = 'civicrm/pcp/info';
$mailParams['module'] = 'contribute';
}
Expand Down Expand Up @@ -298,9 +299,11 @@ public static function sendMail($contactID, &$values) {
$fromName = $email;
}

// use contact email, CRM-4963
if (empty($values['email_from'])) {
$values['email_from'] = $email;
if (Civi::settings()->get('allow_mail_from_logged_in_contact')) {
// use contact email, CRM-4963
if (empty($values['email_from'])) {
$values['email_from'] = $email;
}
}

$templateParams = array(
Expand Down

0 comments on commit 14065de

Please sign in to comment.