I have a custom extension which I have working great- sends out email using the CRM_Utils_mail function. The emails go out fine, look fine, but are not registered to the contact's profile (not under the Mailings tab, or any of the others).

$emailbody = (CRM_Core_Smarty::singleton()->fetch($turl));
        $params = array();
        $params['from'] = 'Sporting Detection Dogs Association <no@x-x-x.ca>';
        $params['toName'] = $values['Requester_Name'].' '.$values['Requester_lastname'];
        $params['toEmail'] = $contact['email'];
        $params['subject'] = 'Trial Approval';
        $params['text'] = '';
        $params['html'] = $emailbody;

Is there a parameter I can add to make it add to the history for the record? Also, as a sidenote, how do I add more than one toEmail address?

thanks in advance.

1 Answer 1


Take a look at CRM_Activity_BAO_Activity::sendEmail(). An example of its use at https://github.com/civicrm/civicrm-core/blob/236007df15c5e3c65866b9cdd53fcd7593bb82c8/CRM/Contact/Form/Task/EmailTrait.php#L416

Note that it's not an "official" api and may change in the future, but that's also true of CRM_Utils_Mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.