Support

Home Forums Event Espresso Premium An error has occurred: The test message was not sent

An error has occurred: The test message was not sent

Posted: February 3, 2016 at 12:41 pm

Viewing 12 reply threads


grapeinc4macca

February 3, 2016 at 12:41 pm

We are not receiving email notices of registrations. When I tried to use the Send a Test Email function within the templates section, I receive the following:

An error has occurred:
The test message was not sent

No additional information provided.


Josh

  • Support Staff

February 3, 2016 at 1:43 pm

Hi there,

Can you make sure that the To: and From: fields use the non-formatted shortcodes? The reason I ask this is because a few mail servers out there will not send emails with formatted to and from fields. For example, if you have [CO_FORMATTED_EMAIL] in the to: or from: fields, you can change it to be: [CO_EMAIL]


grapeinc4macca

February 4, 2016 at 6:32 am

Same error.

Actions Taken: Changed the FROM to [CO_EMAIL]. Clicked Test Send under Extra Actions.

Other Settings:
TO: [ESPRESSO_ADMIN_EMAIL]
EXTRA ACTIONS: Send a test email to: my email address.


Josh

  • Support Staff

February 4, 2016 at 6:54 am

You can try troubleshooting your built in mailserver by using a WordPress email logging plugin -or- route the email through a transactional email service. We recommend option number 2 and have a guide in our documentation that has more information for you:

https://eventespresso.com/wiki/postmark-app-mandrill-transactional-email-handling-services/


grapeinc4macca

February 11, 2016 at 7:40 am

We have installed Webriti and successfully tested sending messages through our mail server using that software’s test message tool; however, we are still not receiving messages sent using the Send Test Message tool in the Event Espresso > Messages editor.

Checking the server logs, we found that the messages are being rejected by the recipients’ mail servers because, “Messages should have one or no Reply-To headers, not 2.”

EXAMPLE HEADER

To: [REMOVED]
From: MACCA <noreply@macca.us>
Reply-To: MACCA <formmail@macca.us>
Subject: Test email sent from MACCA- Manasota Air Conditioning Contractors Association
Message-ID: <f4bf091cdf0d5596605d0823f7804f30@macca.us>
X-Mailer: PHPMailer 5.2.14 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Reply-To: noreply@macca.us
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

Apparently, emails sent from Event Espresso add both the WordPress admin and the actual sending email account as the Reply-To.

Manually setting the FROM email address in the email template form will make sure that both Reply-To email addresses match; however, there are still two of them listed in the header, so the mail servers still reject the message.

Any idea on how to resolve this?


Josh

  • Support Staff

February 11, 2016 at 8:56 am

The way forward is finding what’s adding this part:

Reply-To: noreply@macca.us
MIME-Version: 1.0

That might be another plugin that’s adding it because EE only adds the first Reply-To.


grapeinc4macca

February 11, 2016 at 10:12 am

The solution is to comment out line 384 of EE_Email_messenger.class.php

protected function _headers() {
		$from = stripslashes_deep( html_entity_decode($this->_from,  ENT_QUOTES,"UTF-8" ) );
		$headers = array(
			'MIME-Version: 1.0',
			'From:' . $from,
//			'Reply-To:' . $from, // <==This line causes a second Reply-To
			'Content-Type:text/html; charset=utf-8'
			);

		//but wait!  Header's for the from is NOT reliable because some plugins don't respect From: as set in the header.
		add_filter( 'wp_mail_from',  array( $this, 'set_from_address' ), 100 );
		add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 );
		return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this );
	}


Tony

  • Support Staff

February 11, 2016 at 10:50 am

Hi there,

The solution is to comment out line 384 of EE_Email_messenger.class.php

The only reason that ‘fixes’ the problem is you are removing one of the Reply-To’s from the headers, whatever else (be it plugin, theme or random function) is adding the other Reply-To will continue to do so.

The only places that EE sets the headers is that function above, so as you can see its using and array with 4 values. If EE was adding that twice you would have 2 of each of those values and not just Reply-To.

The problem with EE’s emails is a symptom to a bigger problem with the emails generated on that site, any other plugin that adds Reply-To to the headers is going to run into the same problem because something is hooking into wp_mail() and adding another Reply-To to the headers, this is fine if one is not set, but not so if one already is.

Do you have any other plugins that that do anything at all to emails?


Josh

  • Support Staff

February 11, 2016 at 11:05 am

That is not a viable solution.


grapeinc4macca

February 11, 2016 at 11:20 am

I understand what you are saying, but you have to remember that we ARE receiving email notices from other plugins and from the WordPress core. So your assumption that other plugins will have the same problem is incorrect.

If any other plugins do have this same problem, it will be because they are submitting a reply-to address to the Webriti SMTP plugin. An alternate solution would be to disable line 145 of webriti-smtp-mail.php

$phpmailer->AddReplyTo(webriti_smtp_mail_from_email(), webriti_smtp_mail_from_name());	

I have tested both solutions and they both work.

Since the Reply-To address is not required, altering the Webriti plugin’s code is a more logical solution because it would resolve sending errors across all plugins that specify a Reply-To address.


Josh

  • Support Staff

February 11, 2016 at 11:48 am

That’s also not a viable solution because you’ve hacked the plugin, and will not be able to update without re-hacking again. A viable solution is remove the extra params via a hook. Usually those are added by filters, so you can avoid directly editing the plugins that way.


grapeinc4macca

February 11, 2016 at 12:09 pm

Sounds great Josh. So, can you provide a filter to remove the reply-to from emails generated by Event Espresso along with instructions on how to add it to the site without modifying any of the plugins’ files? That would be a great.


Josh

  • Support Staff

February 11, 2016 at 1:25 pm

I’m sorry I wasn’t very clear in the last reply, I was referring to using a hook in the email plugin. If you look a bit down from line 145 of webriti-smtp-mail.php, you’ll find the hook that you can use to unset the reply to value. The name of the hook is wp_mail_smtp_custom_options.

Viewing 12 reply threads

The support post ‘An error has occurred: The test message was not sent’ 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