Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

Simple code:

mail("[email protected]", $subject, $text);

It doesn't send email, but it still, returns TRUE. What is hapenning?

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

like image 585
good_evening Avatar asked Mar 30 '11 17:03

good_evening


1 Answers

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)

like image 188
Naftali Avatar answered Sep 18 '22 18:09

Naftali