/    Sign up×
Community /Pin to ProfileBookmark

Mail() always returns true…

Hi all,

I use the Mail() function to send mail from a few of our servers, and I’ve just noticed that it always returns true even if the email address doesn’t exist.

[code]
$mail_sent = @mail(“[email protected]”, “Test Email”, “This is a test email”, “From: [email protected]”);

echo $mail_sent;
[/code]

Any idea why this could be?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Stephen_PhilbinFeb 22.2008 — The return value of mail only indicates whether or not the mail was accepted by your local MTA (Mail Transfer Agent) for delivery, not whether or not it was received (or even sent out for that matter).

Source: http://devzone.zend.com/manual/function.mail.html

[b]Return Values[/b]

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.
[/quote]


Getting mail from your host to its intended recipient is a nightmare. There's [b]much[/b] more to it than simply configuring your software. Once you're getting mail [i]out[/i] from your host, you then begin the much greater battle of having your mail [i]accepted[/i] by the systems on other hosts.

Take care not to confuse mail not getting delivered with mail not getting sent, once you get past the initial problems of sorting out your local mailer.
Copy linkTweet thisAlerts:
@cusimar9authorFeb 25.2008 — In ASP its easy enough, I've written plenty of websites which return the status of mail delivery. There must be a way of doing it with PHP?
×

Success!

Help @cusimar9 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...