【发布时间】:2015-05-17 05:50:59
【问题描述】:
php代码:
<?php
$to = 'vickee@hotmail.com';
$subject = 'Testing sendmail.exe';
$message = 'Hi, you just received an email using sendmail!';
$headers = 'From: vignesh@gmail.com' . "\r\n" .
'Reply-To: vignesh@gmail.com' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers))
echo "Email sent";
else
echo "Email sending failed";
?>
我在 gmail 中启用了第二步验证。是不是因为这个问题,我在运行 php 代码时收到“已发送电子邮件”。但是发送或收件人的收件箱或垃圾文件夹中没有邮件。有没有替代方法?如果是这样,请评论链接以逐步使用该服务发送电子邮件。
编辑:
我已经按照http://arpanthakrar.blogspot.in/2013/06/send-email-from-localhostwamp-server.html中的说明设置了邮件部分
如果有任何其他方法或对此方法进行更改,请告诉我。
【问题讨论】:
-
据我所知,如果没有经过适当的验证,您不能简单地使用 gmail 服务器发送电子邮件。有关更多信息,请参阅问题:stackoverflow.com/questions/712392/…