Email 使用wp_邮件,只在Gmail帐户中接收不到的电子邮件(雅虎和Hotmail可以)
我在WordPress中创建了一个新的自定义页面来测试发送电子邮件,这是我的代码Email 使用wp_邮件,只在Gmail帐户中接收不到的电子邮件(雅虎和Hotmail可以),email,wordpress,gmail,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_fro
<?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(); ?>
最近,许多电子邮件服务对垃圾邮件非常严格,所以我的所有Wordpress联系人表单都出现了问题。我最终解决了wp smtp插件的问题。这与其说是一个实际的解决方案,还不如说是一个变通办法……不要使用example.com和xxxxxx在gmail上进行测试。我宁愿使用随机的2个或更多字符串。也要像奥利弗说的那样检查你的垃圾邮件。