function send_custom_emails_on_tour_booking($booking_id) { // Get booking details $booking = STBooking::find($booking_id); // Define recipients $recipients = ['[email protected]', '[email protected]']; // Email subject $subject = 'New Tour Booking'; // Email message $message = sprintf( "A new tour has been booked.\n\nBooking ID: %d\nTour Name: %s\nCustomer Name: %s\nCustomer Email: %s\n", $booking->ID, get_the_title($booking->tour_id), $booking->customer_name, $booking->customer_email ); // Headers $headers = ['Content-Type: text/plain; charset=UTF-8']; // Send email to each recipient foreach ($recipients as $recipient) { wp_mail($recipient, $subject, $message, $headers); } } // Hook into the booking process add_action('st_after_booking_created', 'send_custom_emails_on_tour_booking');
Filters
Clear filter

Morocco: 13 tours found