Support

Home Forums Event Espresso Premium Email Sending Doesn't Work with SES

Email Sending Doesn't Work with SES

Posted: April 4, 2016 at 4:05 pm

Viewing 1 reply thread


farmmedia

April 4, 2016 at 4:05 pm

We relay all our WordPress emails through Amazon SES. Emails generated by EE are being rejected by SES because of duplicate email header information. Here is an explanation of the problem and a code modification that will fix it.

Please let me know if you can implementt his fix.
————
Plugin email gets a bounce from SES with error “554 Transaction failed: Duplicate header ‘MIME-Version’.”

Local mail server relay log sample:

** removed for clarity **
status=bounced (host email-smtp.us-east-1.amazonaws.com[50.19.95.232] said: 554 Transaction failed: Duplicate header ‘MIME-Version’. (in reply to end of DATA command))
** removed for clarity **

Solution: Comment out line 382 in /var/www/vhosts/aginmotion.ca/wp-content/plugins/event-espresso-core-reg/core/libraries/messages/messenger/EE_Email_messenger.class.php

379            protected function _headers() {
380                 $from = stripslashes_deep( html_entity_decode($this->_from,  ENT_QUOTES,”UTF-8″ ) );
381                 $headers = array(
382                         ‘MIME-Version: 1.0’,
383                         ‘From:’ . $from,
384                         ‘Reply-To:’ . $from,
385                         ‘Content-Type:text/html; charset=utf-8’
386                         );
387
388                 //but wait!  Header’s for the from is NOT reliable because some plugins don’t respect From: as set in the header.
389                 add_filter( ‘wp_mail_from’,  array( $this, ‘set_from_address’ ), 100 );
390                 add_filter( ‘wp_mail_from_name’, array( $this, ‘set_from_name’ ), 100 );
391                 return apply_filters( ‘FHEE__EE_Email_messenger___headers’, $headers, $this->_incoming_message_type, $this );
392         }

  • This topic was modified 8 years, 7 months ago by Josh. Reason: removed log items for clarity


Josh

  • Support Staff

April 4, 2016 at 5:00 pm

Hi John,

You add this code to your site, which uses the filter hook in the Event Espresso 4 plugin:

add_filter( 'FHEE__EE_Email_messenger___headers', 'my_remove_mime_type_from_ee_email_headers', 10 );
function my_remove_mime_type_from_ee_email_headers( $headers ) {
	array_shift( $headers );
	return $headers;
}

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.

  • This reply was modified 7 years, 4 months ago by Tony. Reason: array_shift() returns the first value from the array, so we don't want to set $headers to that value
Viewing 1 reply thread

The support post ‘Email Sending Doesn't Work with SES’ 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