Commit 1b7d92ef authored by jaapjansma's avatar jaapjansma

Merge branch 'toEmail' into 'master'

Clarify variable name $email -> $toEmail

See merge request !7
parents 22e850a5 44cdb746
...@@ -147,7 +147,7 @@ function civicrm_api3_email_send($params) { ...@@ -147,7 +147,7 @@ function civicrm_api3_email_send($params) {
* *
*/ */
$toName = ''; $toName = '';
$email = $alternativeEmailAddress; $toEmail = $alternativeEmailAddress;
} elseif ($contact['do_not_email'] || empty($contact['email']) || CRM_Utils_Array::value('is_deceased', $contact) || $contact['on_hold']) { } elseif ($contact['do_not_email'] || empty($contact['email']) || CRM_Utils_Array::value('is_deceased', $contact) || $contact['on_hold']) {
/** /**
* Contact is decaused or has opted out from mailings so do not send the e-mail * Contact is decaused or has opted out from mailings so do not send the e-mail
...@@ -157,7 +157,7 @@ function civicrm_api3_email_send($params) { ...@@ -157,7 +157,7 @@ function civicrm_api3_email_send($params) {
/** /**
* Send e-mail to the contact * Send e-mail to the contact
*/ */
$email = $contact['email']; $toEmail = $contact['email'];
$toName = $contact['display_name']; $toName = $contact['display_name'];
} }
...@@ -217,7 +217,7 @@ function civicrm_api3_email_send($params) { ...@@ -217,7 +217,7 @@ function civicrm_api3_email_send($params) {
'groupName' => 'E-mail from API', 'groupName' => 'E-mail from API',
'from' => $from, 'from' => $from,
'toName' => $toName, 'toName' => $toName,
'toEmail' => $email, 'toEmail' => $toEmail,
'subject' => $messageSubject, 'subject' => $messageSubject,
'messageTemplateID' => $messageTemplates->id, 'messageTemplateID' => $messageTemplates->id,
]; ];
...@@ -237,7 +237,7 @@ function civicrm_api3_email_send($params) { ...@@ -237,7 +237,7 @@ function civicrm_api3_email_send($params) {
} }
$result = CRM_Utils_Mail::send($mailParams); $result = CRM_Utils_Mail::send($mailParams);
if (!$result) { if (!$result) {
throw new API_Exception('Error sending e-mail to ' . $contact['display_name'] . ' <' . $email . '> '); throw new API_Exception('Error sending e-mail to ' . $contact['display_name'] . ' <' . $toEmail . '> ');
} }
//create activity for sending e-mail. //create activity for sending e-mail.
...@@ -282,7 +282,7 @@ function civicrm_api3_email_send($params) { ...@@ -282,7 +282,7 @@ function civicrm_api3_email_send($params) {
$returnValues[$contactId] = [ $returnValues[$contactId] = [
'contact_id' => $contactId, 'contact_id' => $contactId,
'send' => 1, 'send' => 1,
'status_msg' => "Successfully send e-mail to {$email}", 'status_msg' => "Successfully sent e-mail to {$toEmail}",
]; ];
} }
......
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