以下代碼顯示「郵件發送成功...」,但發出的郵件未在收件箱的收件箱或垃圾郵件文件夾中收到。在郵件中收不到通過郵件發送的郵件()功能
<?php
$to = "[email protected]";
$subject = "This is subject";
$message = "<b>This is HTML message.</b>";
$message .= "<h1>This is headline.</h1>";
$header = "From:[email protected] \r\n";
$retval = mail ($to,$subject,$message,$header);
if($retval == true)
{
echo "Message sent successfully...";
}
else
{
echo "Message could not be sent...";
}
?>
我已經改變了[郵件功能]在php.ini像這樣
[mail function]
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
而且[sendmail的在sendmail.ini這樣
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=
[email protected]
auth_password=mymailid_pass
[email protected]
所以一切都很好並且$retval
返回true,並且echo'Message sent successfully ...',但接收者不會收到他的收件箱或垃圾郵件。 我也啓用imap
在gmail settings->forwarding and pop/imap
。
以下系您的Gmail設置是否正確?從您的其他帳戶(雅虎等)發送測試郵件並檢查您是否收到任何郵件? – jitendrapurohit
你檢查了error.log文件嗎? – Priya
@Priya - 我如何檢查error.log文件在哪裏? –