25% off ProSNIPC25OFF

Set a Custom Reply-To Address

Adds a Reply-To header to every outgoing WordPress email so replies route to a chosen address instead of the sender.

PHPby SnipCraft
php
<?php
add_filter( 'wp_mail', 'scseed_custom_reply_to' );
if ( ! function_exists( 'scseed_custom_reply_to' ) ) {
    function scseed_custom_reply_to( $args ) {
        $reply_to = '[email protected]'; // Change to your preferred reply-to address.
        if ( ! isset( $args['headers'] ) ) {
            $args['headers'] = array();
        }
        if ( is_string( $args['headers'] ) ) {
            $args['headers'] = array( $args['headers'] );
        }
        $args['headers'][] = 'Reply-To: ' . $reply_to;
        return $args;
    }
}
#email#notifications#reply-to#wp_mail