试试这个
add_filter(\'wp_mail_from\', \'doEmailFilter\');
add_filter(\'wp_mail_from_name\', \'doEmailNameFilter\');
function doEmailFilter($email_address){
if($email_address === "[email protected]")
return \'[email protected]\';
else
return $email_address;
}
function doEmailNameFilter($email_from){
if($email_from === "WordPress")
return \'MySite.com\';
else
return $email_from;
}
这将检查WP是否将作为系统发送邮件(作为wordpress@something)如果是,请更改您的设置。否则,将使用输入数据(邮件和姓名)。