Forum Moderators: coopster

Message Too Old, No Replies

my test email validity script won't work :(

         

al1911

2:22 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



i've written it out exactly like all the tutorials say and it still doesn't work. the script is...

$Success = mail('email@email.com', 'subject', 'message');
if ($Success) {
echo "email was sent"; }
else {
echo "email was not sent"; }

now, this script should write out "email was not sent" because the adress email@email.com obviously does not exist, nor do any other invalid emails i've tried. but the script always types out "email was sent" regardles of wether the message was sent or not.

how do i make it so that if the email address does not exist, it spits back an error message?

i'm using php5 on mac osx server 10.3.8

Birdman

2:38 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

I found this message in the notes of the php.net/mail page:

Mac OS X users will need to "enable" sendmail (v10.2 and earlier) or postfix(v10.3). Otherwise mail sent with mail() will just que up on your computer and never be delivered anywhere. You will receive no error regarding this from php as php is doing its job just fine.

Sounds like it could be your problem.

Cheers,
Birdman

al1911

2:49 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



but this is just it. if the address does exist, then it gets delivered just fine, so i can send mail to my email inboxes just fine, most of which are not on this server. but if the address doesn't exist, the page acts as though it does

jatar_k

5:30 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



just because the email address doesn't exist doesn't mean it wasn't sent successfully. It will be put in the mail queue and sent anyway and then will return later.

All of this has nothing to do with whether the function succeeded.

al1911

6:15 am on Mar 23, 2005 (gmt 0)

10+ Year Member



ah, now i'm with you. so the if (mail... only checks to see if the mail has been sent, and returns ok regardless of whether or not it was recieved.

in that case, does anyone know of a way i can truely find out if the mail was sent AND recieved?

dcrombie

9:40 am on Mar 23, 2005 (gmt 0)



There's no 100% reliable method of checking that an email has been received. A popular option is to use an HTML email that sources images from your site which you can then see in the logs. That only works if the mail client actually loads the images (many now don't by default).

There are also PHP methods for checking that a MX record exists for the email domain, but even that's not perfect, and will never tell you if the username is valid.

;)