Necessary params are not passed to mte_civicrm_alterMailParams
I have a site that uses the Mandrill Email extensions (MTE) for sending CiviCRM emails. And this works fine for sending registration confirmations and the donate webform receipts. But we are having an issue when we attempt to send a single email. If I disable MTE, the email sends just fine. But when it is enabled and I attempt to send an email, it just hangs.
The error message is: “Field 'contact_id' doesn't have a default value". But as well, no toEmail is sent to MTE.
I have (I think) narrowed the issue to the fact that mte.php:mte_civicrm_alterMailParams is not passed the params it needs, including the toEmail CRM_Core_BAO_MessageTemplate::renderTemplate.
"mte_civicrm_alterMailParams" "args" => array:2 [ 0 => array:19 [ "workflow" => "UNKNOWN" "modelProps" => null "contactId" => "28285" "messageTemplateID" => null "disableSmarty" => true "from" => null "toName" => null "toEmail" => "" "cc" => null "bcc" => null "replyTo" => null "attachments" => null "PDFFilename" => null "messageTemplate" => array:3 [ "msg_text" => "" "msg_html" => "<p>test mandrill email single 4</p>\r\n" "msg_subject" => "test mandrill email single 4" ] "isTest" => false "tplParams" => array:1 [ "contactID" => "28285" ] "tokenContext" => array:7 [ "schema" => array:1 [ 0 => "contactId" ] "smarty" => false "contactId" => "28285" "contact" => null "locale" => null "requestedLocale" => null "smartyTokenAlias" => array:1 [ "taxTerm" => "domain.tax_term" ] ] "valueName" => "UNKNOWN" "activityId" => 128292 ] 1 => "messageTemplate" ] ]
The alterMailParams hook is called by CRM_Core_BAO_MessageTemplate::renderTemplate from CRM_Contact_Form_Task_EmailTrait:sendEmail which is called by the submit function. It seems the issue is that the toEmail is not being passed to the alterMailParams.
MTE attempts to use the toEmail to get the associated contact information when mte_targetContactIds is called. But this is unsuccessful since no toEmail address is passed.
This seems to be an issue of Core needing to pass the proper params. Can you confirm?