开发者

PHP mail returns TRUE, but e-mail is not sent

Simple code:

mail("my_email@gmail.com", $subject, $text);

It d开发者_C百科oesn't send email, but it still, returns TRUE. What is hapenning?

P.S. Even if I add headers, the result is the same!


from the man page for mail():

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.


Basically there is nothing you really can do in plain ol' PHP unless you actually check the wire to see what is going on. I would suggest using some mail library that has some indication of whether the mail sent or not (if it exists)


Do you know for a fact the email is not sending? The email could go from your php script to your SMTP server, but get dropped somewhere between the first SMTP server and gmail.

Try looking at network traffic to verify that the email is being sent using something similar to wireshark.


See @Neal's comment. Simply returning true means very little.

You should check your PHP.ini and make sure your SMTP servers are set correctly (if on Windows) or that your sendmail path (Linux) is correct. From there, check your sendmail configuration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜