I have changed it a bit, so the code is shorter and better ??
Step 1:
In wp-content/events-manager/classes/em-mailer.php add this to line 99 (just above $send = $mail->Send();)
do_action('em_mailer_before_send', $mail);
Step 2:
Add this snippet to your functions.php:
function stonehenge_em_email_replyto( PHPMailer $mail ) {
global $EM_Booking;
$recipients = $mail->getToAddresses(); // Allows access to protected array.
// If is new booking with online payment.
if(!is_object($EM_Booking)) {
global $wpdb;
$table = EM_TRANSACTIONS_TABLE;
$transaction_id = $_REQUEST['id'];
$booking_id = $wpdb->get_var("SELECT booking_id FROM {$table} WHERE transaction_gateway_id= {$transaction_id}");
$EM_Booking = em_get_booking(esc_attr($booking_id));
}
// Only target Admin Emails.
if( !in_array($EM_Booking->get_person()->user_email, $recipients[0]) ) {
$mail->AddReplyTo( $EM_Booking->get_person()->user_email );
}
return;
}
add_action('em_mailer_before_send', 'stonehenge_em_email_replyto', 10, 1);
Enjoy! ??