Creating the Difference

Add ReplyTo Admin Emails in Events Manager

Posted on: 04-01-2019
Categories: PHP, Snippets Tags: , , ,
This tutorial will not work with wp_mail(). Please use any other email sending method within Events Manager.
Plugins such as WP Mail SMTP use wp_mail() as well.

What is this post about?

In this post I will explain how you can add a ReplyTo address to your outgoing Admin emails.

Make sure your settings are correct.

In Events Manager there are several options to send outgoing emails to Event Admin and Bookings. The easiest way is by using the wp_mail() method, but this also the most limited one. Please make sure you are using any other method before continuing. Send email using the SMTP protocol is preferred as that has the highest level of security.

Step 1: Manually change one line of code.

In order to be able to hook into the outgoing emails at exactly the right time, we will need to change the original Events Manager code, just a little. In the file wp-content/plugins/events-manager/classes/em-mailer.php scroll down to around line 80 and find:

Move that line 8 lines down, just above the //Protocols comment.
The end result should look like this:

Step 2: Add a ReplyTo address to Admin Emails.

By default Events Manager sends all outgoing emails with the same “From” details (name and email address). So if the Admin hits “Reply” on that email, he/she will send it it him/herself. Let’s change that!

By adding a ReplyTo address, the original message will remain unchanged, but it will add a new recipient if the Admin clicks “Reply”. Of course you will want the email to go to the person who placed the booking, so we will add that.
Add this to your functions.php:Click here to learn how to safely add your code to WordPress.

Let me know what you think 😉