# Postfix 501 Invalid Address - Recover these messages?

I built a form for a client and realized that I used an invalid address for the FROM field. (501 Invalid Address (in reply to MAIL FROM command)).

Is there any way that I can recovered these form submissions that were suppose to have been emailed to my client? It currently seems like postfix just removed them.

Running Debian.

Ideas?

-

If your web server was going to connect to your client's email host directly (instead of using a smarthost), you may find them in root's mailbox, or possibly in the mailbox for the user which submitted the email (www-data, perhaps).

If they went to a smarthost to be delivered, then I'd look in root's mailbox on that smarthost.

Added: If you have access to all the mailservers involved, you may be able to look in the mail logs and see where the emails were put-- they're typically flagged as "dead letters", or "dead.letter"... If you can't find them or any reference to them in the mail.log, I can't think of any other things to try.

-
I looked in /var/spool/mail but i don't see any folders for users. Is mail for root and the apache user located elsewhere? –  Zed Said Oct 5 '10 at 21:40
only if they have .procmail or something like that to move them to a different location, which wouldn't be the default situation in any unix installation that I've ever seen. If you have access to all the mailservers involved, you may be able to look in the mail logs and see where the emails were put-- they're typically flagged as "dead letters", or "dead.letter"... If you can't find them or any reference to them in the mail.log, I can't think of any other things to try. –  unixguy Oct 6 '10 at 18:50

Where to look would depend on how your web application sends emails. If your web application sends emails by "speaking" SMTP to the mail server directly, then the email is gone since the MAIL FROM: command comes before the content of the email is transmitted so it aborted without sending the email anywhere.

Otherwise, what happens depends on the language and the function you use to send mail. PHP's mail() function on Linux, for instance, sends mail using the local sendmail application, which "injects" the mail into the local SMTP server for that server to deliver. What happens then depends on the server and the problem. In my case, bad mail sent from PHP over exim usually bounces to the www-data user, but occasionally exim "freezes" the message in the queue because it can't figure out what to do with it. It's likely postfix does something similar, in which case the email is probably in a folder like /var/spool/postfix/ rather than /var/spool/mail/

-