Support

Home Forums Event Espresso Premium The cc option not working with mandril in EE4 email template

The cc option not working with mandril in EE4 email template

Posted: February 12, 2019 at 7:22 am


LegalHeat12

February 12, 2019 at 7:22 am

We have configured mandril with event espresso. To get a copy of the recipient email to primary registrant we have updated the email templates as below link. However the cc in not including in mandril email delivery. Please advice.

https://prnt.sc/mk343c


Josh

  • Support Staff

February 12, 2019 at 9:33 am

Hi,

You can install & activate this code as a plugin on your site:

https://gist.github.com/nerrad/2686a4be42da2ca76047

and what that will do is hook into the Mandrill plugin to allow the sending a cc to the email address in the CC field.


LegalHeat12

February 12, 2019 at 11:58 am

Hi Josh,

The suggested method is not working. Could you recheck the suggested link as it does not contain cc related formatting?


Josh

  • Support Staff

February 12, 2019 at 12:37 pm

May I ask what do you mean by “does not contain cc related formatting”? Are you using this Mandrill plugin?

https://wordpress.org/plugins/send-emails-with-mandrill/


LegalHeat12

February 13, 2019 at 2:37 am

Yes. We are using this plugin.
https://wordpress.org/plugins/send-emails-with-mandrill/

The primary registrant still not receiving a copy of the other recipient’s emails.

We have used below code in a plugin as you suggested. Please have a look into this.

function rse_fix_wpmandrill_to( $payload ) {
$new_to = array();
if ( isset( $payload[‘to’] ) ) {
foreach ( $payload[‘to’] as $to ) {
$new_to[] = rse_maybe_parse_formatted_email( $to );
}
} else {
return $payload;
}

$payload[‘to’] = $new_to;
return $payload;
}
add_filter( ‘mandrill_payload’, ‘rse_fix_wpmandrill_to’ );

function rse_maybe_parse_formatted_email( $to ) {
$to_address = isset( $to[’email’] ) ? $to[’email’] : null;

if ( empty( $to_address ) ) return $to; //get out because wpMandrill has likely started doing something strange.

if( preg_match( ‘/(.*)<(.+)>/’, $to_address, $matches ) ) {
if ( count( $matches ) == 3 ) {
$to[‘name’] = $matches[1];
$to[’email’] = $matches[2];
}
}

return $to;
}


Josh

  • Support Staff

February 13, 2019 at 8:55 am

Hi,

In addition to the above, can you add the following:

https://gist.github.com/joshfeck/cffccb7ca8a8bca82b9851f2e01b2d20

Also, please be sure to activate the custom plugin after the code is added.


LegalHeat12

February 14, 2019 at 2:28 am

Hi,

Thanks, Josh. Now cc is working. However primary registrant is now receiving an additional mail of his registration.ie for single registrant is getting 2 emails.

Is there a way to filter this condition. So that single registrant (or primary registrant) should receive only one mail of his/her registration.

https://prnt.sc/mk343c


Josh

  • Support Staff

February 14, 2019 at 10:23 am

If you remove the Primary Registrant Email shortcode from the CC field, the Primary Registrant will receive only one mail of their registration for that message type.

Then, if you want to send the Primary Registrant an additional email that includes a summary of all registrations in the transaction, you can activate the Primary Registrant Recipient context of that message type.


LegalHeat12

February 15, 2019 at 3:12 am

Hi Josh,
In our requirement, the primary registrant needs to receive an email copy of other registrant and only one his registration email, not the summary email.
Example scenario: (Primary, Registrant A and Registrant B )

1.Primary (Primary member’s registration email)

2.Registrant A (One email to Registrant A and copy to primary)

3.Registrant B (One email to Registrant B and copy to primary)

Please have a look into this.


Josh

  • Support Staff

February 15, 2019 at 7:07 am

Hi,

I’ve looked into this and I don’t believe there’s a way to not send a cc a copy to the Primary Attendee if you’ve set the Primary Attendee email’s address into the cc field. One thing to keep in mind is the Primary Attendee is a registrant too.

In other words, in the scenario you’ve outlined, it’s more like:

1.Primary, is also Registrant A
2.Registrant B
3.Registrant C

The support post ‘The cc option not working with mandril in EE4 email template’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso