一, 如果你使用Wordpress默认mail()函数发送, 修改WordPress发送邮件的默认邮箱和发件人, 在你的主题文件夹下functions.php加上
//change WordPress default mail_from information
function new_from_name($email){
$wp_from_name = get_option('blogname');
return $wp_from_name;
}
function new_from_email($email) {
$wp_from_email = get_option('admin_email');
return $wp_from_email;
}
add_filter('wp_mail_from_name', 'new_from_name');
add_filter('wp_mail_from', 'new_from_email');
一, 如果你SMTP服务发送, 在你的主题文件夹下functions.php加上
//使用smtp发邮件
function mail_smtp( $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true;//启用SMTPAuth服务
$phpmailer->Port = 25;//MTP邮件发送端口,这个和下面的对应,如果这里填写25,则下面为空白
$phpmailer->SMTPSecure = "";//是否验证 ssl,这个和上面的对应,如果不填写,则上面的端口须为25
$phpmailer->Host = "smtp.qq.com";//邮箱的SMTP服务器地址,如果是QQ的则为:smtp.qq.com
$phpmailer->Username = "568508200@qq.com";//你的邮箱地址
$phpmailer->Password ="xzg007";//你的邮箱登陆密码
}
add_action('phpmailer_init', 'mail_smtp');