What is the EASIEST way to send email synchronously using PHP? Specifically, I want incorrect addresses to fail in the script itself, rather than bounce back to the sender later after the script has completed.
You can’t: the mail() function returns true if the mail server rejected the mail (ie for bad formatting), but NOT because it failed to send the mail.
It returns true if the parameters were acceptable to the mail function.
There is NO WAY to find out if your mail has been sent AND received by some recipient (and it is a good thing: Mail spammers would generate random email addresses and try to send an email. If they could know that “there is no such address”, they would be even more successful at spamming the world!)
There’s unfortunately no easy way to detect if an email is valid or not, but you can check if an email matches some very simple “formatting rules” by performing a regular expression match on them
Some more info is available at http://www.roughguidetophp.com/10-regula... Email Addresses
Robinhttp://www.solarisedesign.co.uk
you will have to check the mx records for the email address. here are some examples.
You can’t: the mail() function returns true if the mail server rejected the mail (ie for bad formatting), but NOT because it failed to send the mail.
It returns true if the parameters were acceptable to the mail function.
There is NO WAY to find out if your mail has been sent AND received by some recipient (and it is a good thing: Mail spammers would generate random email addresses and try to send an email. If they could know that “there is no such address”, they would be even more successful at spamming the world!)
There’s unfortunately no easy way to detect if an email is valid or not, but you can check if an email matches some very simple “formatting rules” by performing a regular expression match on them
Some more info is available at http://www.roughguidetophp.com/10-regula... Email Addresses
Robinhttp://www.solarisedesign.co.uk