25% off ProSNIPC25OFF

Set Site Name and No-Reply From Address for wp_mail

Overrides the default WordPress email sender name with the site name and the from address with a noreply@ address derived from the site domain.

PHPby SnipCraft
php
<?php
if ( ! function_exists( 'scseed_mail_from_address' ) ) {
    function scseed_mail_from_address( $from_email ) {
        $host = wp_parse_url( home_url(), PHP_URL_HOST );
        return 'noreply@' . $host;
    }
    add_filter( 'wp_mail_from', 'scseed_mail_from_address' );
}

if ( ! function_exists( 'scseed_mail_from_name' ) ) {
    function scseed_mail_from_name( $from_name ) {
        return get_bloginfo( 'name' );
    }
    add_filter( 'wp_mail_from_name', 'scseed_mail_from_name' );
}
#email#mail#notifications#smtp