I had a custom WooCommerce mailer function below for sending emails to customers as a notification of there purchase, but I got a requirement to add reply-to tag.
To describe in detail, customer has to get email($order->billing_email
) for the order notification from store@mycompany.com
and need to append reply-to tag for support@mycompany.com
.
What this does is that emails will be send from store@mycompany.com
, but when customers hit reply when they want to ask us any questions, these replies will go to support@mycompany.com
Can any one help me how to change the $mailer->send
function to achieve the requirement ?
function my_awesome_publication_notification($order_id, $checkout=null) {
global $woocommerce;
$order = new WC_Order( $order_id );
if($order->status === 'completed' ) {
// Create a mailer
$mailer = $woocommerce->mailer();
$message_body = __( 'Hello world!!!' );
$message = $mailer->wrap_message(
// Message head and message body.
sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message_body );
// Client email, email subject and message.
$mailer->send( $order->billing_email, sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message );
}
}
}