Sending email with SMTP to bogus email accounts

I use the following code to display an error message if there are problems while sending messages through my SMTP server:

if (PEAR::isError($mail)) {

$errorMessage = $mail->getMessage();
print ("<p>$errorMessage</p>");

Today I put a bogus address on my domain to see what would happen. I used Here is the error I got:

Failed to add recipient: [SMTP: Invalid response code received from server (code: 550, response: No Such User Here")]

[FONT=arial, sans serif][COLOR=#000000]I tried sending the same test message to a bogus account on another domain. I tried using and the message actually went out successfully and later bounced about 5 minutes later. So why does the “No Such User Here” message only work on my own domain? If I can figure out how to do this for other domains, then I can write some code that will suspend a user’s account that is generating send errors on the fly.



In the first case the bounce was generated immediately. This is not common
Most often the bounce email bounces back after some time has passed - sometimes 5 seconds, sometimes could be hours.
This depends on the server where you sending the message. probably has hundreds of thousands of email accounts and hundreds of smtp servers in their network, so it takes some time for them to figure out that email is bouncing.

Generally you cannot detect bounce email from the same script that sends out an email. Detecting and processing bounced emails is actually a pretty complicated task.