首页 > 解决方案 > 来自地址的 Wordpress smtp 邮件不起作用

问题描述

wp_mail_smtp用于在 WordPress 中发送邮件,它的工作正常期望一件事我已经定义了来自电子邮件:abc@mysite.com和来自名称:我的站点和用于 smtp 身份验证的用户名密码是:someemail@example.com和我的密码邮件编号。

现在的问题是,当我发送邮件时,我收到的邮件标题比

mysite< someemail@example.com > 它应该是 mysite< abc@mysite.com > 我还设置了来自名称和来自邮件的过滤器,如下面的代码

add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
    return 'abc@mysite.com';
}
function new_mail_from_name($old) {
    return 'mysite.com';
}

我的邮件代码是

$headers = 'From: abc@mysite.com ' . "\r\n";
$to = "admin@test.com"
$send_subject = "Mail Subject"
$message .= "Some message";
wp_mail( $to, $send_subject, $message,$headers );

请告诉我我做错了什么,以便我可以正确接收邮件标题

谢谢

标签: wordpresssmtpsmtpclient

解决方案


推荐阅读