Ssmtp default email address

Hello there,

I wish to know where can I config the wordpress system mail ?

I received a system mail for reset pass/ create user from wordpress@domain.com

It’s possible I can change that email address? such as webmaster@domain.com

I believe this is done through WP itself: https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail_from_name

1 Like

Hm, I’ve added this to my site

add_filter('wp_mail_from', __NAMESPACE__ . '\\new_mail_from');
function new_mail_from($old) {
    return 'info@mydomain.tld';
}

add_filter('wp_mail_from_name', __NAMESPACE__ . '\\new_mail_from_name');
function new_mail_from_name($old) {
    return 'Information';
}

but it sends mail as web@mydomain.tld anyway.

Adding this
web:info@mydomain.tld
into /etc/ssmtp/revaliases

Worked for me. But cannot control the from name this way it seems.

@intelligence Your code should work. I have just tested it myself. No need for the namespaces:

add_filter('wp_mail_from', function ($email) {
    return 'web@mydomain.ie';
});

add_filter('wp_mail_from_name', function ($name) {
    return 'My Company';
});

My emails came through from My Company web@mydomain.ie when using this method with GSuite / Gmail. Maybe other providers don’t let you override the from address…

1 Like