I want to set a custom from email address for emails that are sent via a plugin. I don't want to change default email address. The following code is not working:
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return 'your email address';
}
function new_mail_from_name($old) {
return 'your name or your website';
}
I want to set a custom from email address for emails that are sent via a plugin. I don't want to change default email address. The following code is not working:
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return 'your email address';
}
function new_mail_from_name($old) {
return 'your name or your website';
}
Share
Improve this question
edited Aug 1, 2019 at 11:29
butlerblog
5,1213 gold badges28 silver badges44 bronze badges
asked Jul 30, 2019 at 7:53
Pranav PatelPranav Patel
211 gold badge1 silver badge4 bronze badges
3
|
1 Answer
Reset to default 0Please use this below code for sending emails in wordpress, which will change the from name.
$recipient_email = "[email protected]";
$subject ="Submission";
$message = "I have done a submission";
$headers = 'Content-type: text/html;charset=utf-8' . "\r\n";
$headers .= 'From: Mastic Technology Rebate <[email protected]>' . "\r\n";
wp_mail($recipient_email, $subject, $message, $headers);
wp_mail()
. – fuxia ♦ Commented Jul 30, 2019 at 9:39wp_mail()
instead. – fuxia ♦ Commented Jul 30, 2019 at 13:52