tags:

views:

103

answers:

2

Hi friends,

Is it possible to capture the failure mail. I have created a application for sending mail, i have a log file to store the sent mails. If the sent mail is failure, i just want to find out the failure mail and update the log file.

Is it possible! Is there any way to match the sent mail and the failure mail

Please help me and guide me.

+2  A: 

If you mean by failure, a bounced email, you can add an email address to 'return-path' header. If the email is bounced it will be returned to the the email address specified in the return-path. You can then set up a service to analyze these emails.

bingle
I think the from is default 'return-path'. Any how tell me how to set "return-path"?
praveenjayapal
It depends on the language you're using. Usually it's through some kind of headers collections.
bingle
A: 

Hi,

You have to specify what client are you using, is it Postfix, sendmail, etc? And what do you mean by "failure".

The basic approach would be to use crontab. It can direct error message to your email, when it fails

[email protected]
#
# run five minutes after midnight, every day
5 0 * * $HOME/bin/emailcode

If you use sendmail, you can always verify the log at:

/var/log/maillog
neversaint
Its not a error, actually its a failure mail(if we enter the wrong email ID)
praveenjayapal