Jump to content


mail function and invalid email addresses

  • Please log in to reply
2 replies to this topic

#1 ben_b

  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 October 2006 - 01:24 AM

I have a php script that sends out emails using the mail() function and for some reason if the email address is incorrect it doesn't send a bounce message to the reply address even though it's set correctly in the headers. Any ideas on how I can fix this?

#2 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 01:30 AM

Send the bounce message yourself.  It probably doesn't bounce becuase it never gets sent.

if(!mail('asdf@asdf.com', 'Subject', 'Message'))
    mail('me@com.com', 'Message: Subject did not go through', 'Error Sending Message: Subject With contents: \nMessage');

#3 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 05 October 2006 - 01:53 AM

There are a few things to consider - minor but FYI worth remeberign for the future...

If this is a case where you want to ensure that the email address provided by a user is valid then check this out http://www.zend.com/...r.php#Heading11 a brilliant method to use during the sigin up process (IMO of course).

Now notwithstanding that I like the above method - its not infallable - the script that actually asks the server if an email address would be accepted does not mean to say that email address exists - they may have a catch all enabled on the domain.

The other point to note is that checking the true/false status of the mail function, if the inbox may simply be full - the email is valid but it will/may be bumped back - making you think that its an invalid address.  You could delete an address that is perfectly OK.
follow me on twitter @PHPsycho

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users