* fullPath : complete pathname to the file
* mime_type: mime type of the attachment
* cleanName: the user friendly name of the attachmment
+ * contactId : contact id to send the email to (optional)
*
* @param array $params
* (by reference).
return FALSE;
}
- $textMessage = $params['text'] ?? NULL;
- $htmlMessage = $params['html'] ?? NULL;
- $attachments = $params['attachments'] ?? NULL;
-
- // CRM-6224
- if (trim(CRM_Utils_String::htmlToText($htmlMessage)) == '') {
+ $htmlMessage = $params['html'] ?? FALSE;
+ if (trim(CRM_Utils_String::htmlToText((string) $htmlMessage)) === '') {
$htmlMessage = FALSE;
}
+ $attachments = $params['attachments'] ?? NULL;
+ if (!empty($params['text'])) {
+ $textMessage = $params['text'];
+ }
+ else {
+ $textMessage = CRM_Utils_String::htmlToText($htmlMessage);
+ // Render the & entities in text mode, so that the links work.
+ // This is copied from the Action Schedule send code.
+ $textMessage = str_replace('&', '&', $textMessage);
+ }
$headers = [];
// CRM-10699 support custom email headers
/**
* @param string $name
- * @param $email
+ * @param string $email
* @param bool $useQuote
*
* @return null|string
* contact ID in RFC822 format.
*
* @param string $from
- * contact ID or formatted "From address", eg. 12 or "Fred Bloggs" <fred@example.org>
+ * civicrm_email.id or formatted "From address", eg. 12 or "Fred Bloggs" <fred@example.org>
* @return string
* The RFC822-formatted email header (display name + address)
*/