Changing From email Id of email alert


#1

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


#2

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' );


#3

Thank you @ned…very much appreciated…


#4

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”


#5

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.


#6

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 ?


#7

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: