<?php
// Function to change email address
add_filter( 'wp_mail_from', function ( $original_email_address ) {
    $email_from = get_option('options_default_email_sender', false);
    if(! $email_from) {
        $domain = preg_replace('/(https:\/\/|http:\/\/|www.)|\/(.*)/', '', get_bloginfo('url'));
        $email_from = 'noreplay@' . $domain;
    }
    return $email_from;
} );

// Function to change sender name
add_filter( 'wp_mail_from_name', function ( $original_email_from ) {
    $name_from = get_option('options_default_name_sender',   get_bloginfo('name'));
    return $name_from;
} );