我在 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 收件箱中找不到任何电子邮件?