Hi Stephen
I have a charity client who offers free events. A bookee completes the booking form and the admin receives an email notifying them. They then manually confirm the booking and the bookee receives a confirmation email.
This was working but now bookees are not receiving emails.
I don’t think this is a mail server issue as we’re using WP Mail SMTP and test emails and other site emails work OK. Admins receive confirmations fine.
I’m using a couple of filters to modify emails:
eventorganiser_booking_notification_email -> (sends to two admin email addresses)
eventorganiser_pre_gateway_booking -> (prevents auto confirmation email)
Has there been a change to this behaviour in recent versions? I’m stumped as to why this has stopped working. Unfortunately as admins have been receiving their emails we’re not sure how long this has been happening for, so can’t pin it down to an update.
WPEO is the latest version.

David McCourt
Booking confirmation e-mails sent to the bookee should still be working. Can you provide the snippets you are using?
(Also have you tried this plug-in to log e-mails being sent)

Stephen Harris
function banana__dont_autoconfirm_free_bookings($booking_id) {
$total_price = eo_get_booking_meta( $booking_id, 'booking_amount');
if (0 == $total_price) {
//Redirect to 'thank you page' - you can change $redirect_id as required here:
$redirect_id = (int) eventorganiser_pro_get_option('booking_redirect');
$redirect = get_permalink( $redirect_id );
wp_redirect( esc_url_raw( $redirect ) );
exit();
}
}
add_action('eventorganiser_pre_gateway_booking', 'banana__dont_autoconfirm_free_bookings', 9999);
function banana__booking_notification_email($emails, $booking_id){
//Get the event ID and organiser ID
$event_id = eo_get_booking_meta($booking_id, 'event_id');
//Get the event's organiser
$organiser_id = get_post_field('post_author', $event_id);
$user_obj = get_userdata($organiser_id);
//If the user exists, add their email to notify both organiser and admin
if($user_obj){
$emails[] = $user_obj->user_email;
}
$emails[] = 'address1@domain';
$emails[] = 'add1ess2@domain';
return $emails;
}
add_filter('eventorganiser_booking_notification_email', 'banana__booking_notification_email', 10, 2);

David McCourt
The client requires using 2 email addresses. address1@ for event stuff and address2@ for other things like contact forms.
I’m using WP Mail SMTP to set the email credentials (using one of the client’s Office365 accounts). This uses address1@ for events.
Scenario 1 In Settings > General > Admin email we use address2@ Emails are sent to the Event organiser/admin but not to bookee.
Scenario 2 In Settings > General > Admin email we use address1@ (same as in WP Mail SMTP) Emails are sent to the Event organiser/admin AND to bookee.
I’m not sure why WPEO is using the Settings > General > Admin email to send to bookees and not the settings in WP Mail SMTP.
I’ve installed the mail log plugin and I can see the emails are being sent but the bookee one is failing in Scenario 1 because it isn’t using the credentials set in WP Mail SMTP.
Thanks
-
This reply was modified 9 years, 4 months ago by
David McCourt.

David McCourt
The plugin uses the General > Settings email as the sender as that’s the only reliably available email. From memory WP Mail SMTP over-rode it with the address provided in their settings, but that might not be the case so I’ll take a look.

Stephen Harris
I’ve had a chance to look at this, and WP Mail SMTP only uses the from e-mail setting if no from e-mail is set in the header. (See https://github.com/ajcrites/wp-mail-smtp/blob/306ae4322eb7bb569e3cc8573a551af0df0742b5/wp_mail_smtp.php#L368-L371)
Event Organiser sets the from e-mail (in the email header) to the site’s admin email as set in Settings> General – by default. However, you can filter that e-mail so it’s different. (See Changing the booking notification email section on this page: http://docs.wp-event-organiser.com/bookings/notification-emails/).
Alternatively you could add a callback onto wp_mail_from
to set the from e-mail.

Stephen Harris