AnsweredAssumed Answered

Add parent to email generated with MailerFactory

Question asked by Francesca Shiekh on Oct 10, 2019
Latest reply on Oct 11, 2019 by André Lopes

I am using MailerFactory to programmatically send emails from a Case.

When the email is sent and the record created, I want to relate the Case to the Email (I have the case id).


There is probably a parameter I can use in the MailerFactory to give the specifics for the emails_beans table to be populated, but I can't find it.

This is the part of my custom function that sends the email:


    if (filter_var($to_addr, FILTER_VALIDATE_EMAIL)){
        $phpMailer = MailerFactory::getSystemDefaultMailer();
        $mailTransmissionProtocol = $phpMailer->getMailTransmissionProtocol();
        $FromEmailIdentity = new EmailIdentity($FromEmailAdd, $FromEmailName);
        $header_array = array(
          'Sender'=>$FromEmailIdentity, //mandatory
        $phpMailer->addRecipientsTo(new EmailIdentity($to_addr, $to_addr));
      }catch(MailerException $me) {
        $message = $me->getMessage();
          "SendGroupEmail: error sending e-mail (method: {$mailTransmissionProtocol}), (error: {$message})"



André Lopes can you help?