email - 使用 wp_mail,仅在 Gmail 帐户中未收到电子邮件(Yahoo 和 Hotmail 都可以)

标签 email wordpress gmail

我在 WordPress 中创建了一个新的自定义页面来测试发送电子邮件,这是我的代码...

<?php
/*
Template Name:testemail
*/

get_header();
add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
function my_mail_from_name( $name )
{
    return 'nameeeeee';
}

wp_mail('salwaieh@gmail.com', 'The subject1', '<p>The <em>HTML</em> message</p>');
wp_mail('salwaieh2012@gmail.com', 'The subjectx', '<p>The <em>HTML</em> message</p>');
wp_mail('salwaieh@hotmail.com', 'The subject2', '<p>The <em>HTML</em> message</p>');
wp_mail('salwaieh@yahoo.com', 'The subject3', '<p>The <em>HTML</em> message</p>');
$to      = 'salwaieh@yahoo.com';
$subject = 'The subject4';
$message = 'The subject4 The subject4 The subject4The subject4 The subject4 The subject4';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);


$to      = 'salwaieh2012@gmail.com';
$subject = 'xxxxxxxxx';
$message = 'The subject4 The subject4 The subject4The subject4 The subject4 The subject4';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);


get_footer(); ?>

我收到了所有发送到 Yahoo 和 Hotmail 帐户的电子邮件,但为什么在我的 Gmail 收件箱中找不到任何电子邮件?

最佳答案

许多电子邮件服务最近对垃圾邮件采取了非常严格的措施,所以我的所有 Wordpress 联系表格都遇到了问题。我最终用 wp-smtp 插件解决了这个问题。它更像是一种解决方法,而不是实际的解决方案......

关于email - 使用 wp_mail,仅在 Gmail 帐户中未收到电子邮件(Yahoo 和 Hotmail 都可以),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10868991/

相关文章:

javascript - 如何在没有服务器的情况下发送电子邮件?只有带有 sendgrid 或

php - 与 wamp 相比,服务器上的内存使用率较高

wordpress - 从帖子中删除链接 - Wordpress

gmail - 如何从 Gmail API 获取没有原始邮件的回复邮件

email - 发送电子邮件时出现 VBScript 错误 '80040211'

html - 有什么方法可以将一些样式繁多的 HTML 与网站的其余样式隔离开来?

android - 如何在android中获取谷歌帐户个人资料照片?

gmail - 无效的 JSON-LD?

asp.net - 如何通过窗口身份验证获取电子邮件地址

php - 如何在mysql中检查数据类型图像?