[kwlug-disc] how to tell programmatically that mail was undeliverable?

Robert P. J. Day rpjday at crashcourse.ca
Wed Mar 31 09:30:06 EDT 2010

  i have a script that's creating a small number of destination e-mail
addresses and, knowing full well that some of them won't represent
valid destination addresses, i expect to get back replies from the
target mail server that this mail was undeliverable, that no such
account exists, etc, etc.  (the target domain itself should exist,
it's only the username that won't be valid in some cases.)

  given that reply, what is the minimal and guaranteed way i can
determine that it represents *precisely* that kind of error
notification?  for instance, based on some testing i've done, i can
see that i can mime decode the reply and, in some cases, the reply
header will contain

  x-failed-recipients:   <destination email address>

in other cases, the header key of "from" will contain "Mail Delivery
System"; in yet others, the subject might say something like
"Undelivered Mail Returned to Sender" or "Returned mail" or a number
of other equivalent phrases.

  however, given a properly-configured mail server at the other end,
is there some RFC-approved notification that is *required* to be sent
back so that i can verify the situation with as little muss and fuss
as possible?  thanks.


p.s. is there, in fact, an RFC that covers this?

Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday

More information about the kwlug-disc mailing list