Changing From email Id of email alert

How can change the from email id for all email alert. Currently it take default pressbooks and it goes to spam folder, we want to change it to an validated email

This is where the email is set: https://github.com/pressbooks/pressbooks/blob/a6b5f5028cf034002a15f6c4b4977cf4b8fb64e9/inc/utility/namespace.php#L906-L926

So, you can use your own custom address by adding this to your wp-config.php:

define( 'WP_MAIL_FROM', 'youremail@yourdomain.com' );

Thank you @ned…very much appreciated…

The Sender name in the emails goes from here

function mail_from_name( $name ) {
if ( defined( ‘WP_MAIL_FROM_NAME’ ) ) {
$name = WP_MAIL_FROM_NAME;
} else {
$name = ‘Pressbooks’;
}
return $name;

Is n’t the Sender name should be of the default “Sitename”…Currently the sender name goes as “Pressbooks”

The default from name in WordPress is WordPress, so we followed the same pattern (see line 258 here). You can change it by doing exactly the same thing I showed you how to do in my previous post, defining WP_MAIL_FROM_NAME to whatever you’d like in wp-config.php.

define( ‘WP_MAIL_FROM’, ‘youremail@yourdomain.com’ ); —This works perfectly fine
define( ‘WP_MAIL_FROM_NAME’, ‘yourdomainname’ ); —This did not work, still pressbook names comes in the name…DId I make any mistake ?

1 Like

Your email screenshots are error logs. We hardcode “Pressbooks” there because these are system logs. We do this because we want to know these come from Pressbooks the system, and not marketing or support. The code is here: