procmail
[Top] [All Lists]

Re: Sendmail error message

1999-08-10 14:03:54
"Bert Hiddink" <hiddink(_at_)galileo(_dot_)or(_dot_)cr> writes:
I want to send out (by means of a Perl script invoqued from the web) 
a message to a certain number of subscriber using /usr/sbin/sendmail. 
When the e-mail is correct, there is no problem. However, when there 
is an address with an incorrect format f.e. hiddink  
_(_at_)galileo(_dot_)or(_dot_)cr, 
sendmail sends the following message to the web:

hiddink  _ @... User unknown galileo.or.cr... User unknown 
/nonexistent/dead.letter... cannot
open /nonexistent/dead.letter: No such file or directory 


This presents 2 problems for me:
1) I do not want these error messages to be printed to the 
subscriber, I would like them only to be logged to an administrator.

2) I am on a virtual server, I do not have administrative control 
over sendmail or sendmail.cf. Appearantly, the error-messages are 
stored per default to /nonexistent/dead.letter which does not exist. 
Therefore, error-messages are lost and besides, I do not have acces 
to them.

Would it be possible for procmail to send out these messages? Since I 
have administrative control over procmail, this would enable me to 
log the error-messages there where I want?

Or would there be other solutions?

Your perl script should pass sendmail the '-oeq' option and then check
$? after the pipe to sendmail is closed.  The -oeq option tells sendmail
to not save the message anywhere on errors, but rather to just return an
error code.  If $? is zero after the close, the message can be considered
sent.  If it's non-zero then there was an error, no message was sent,
and the exact value of $? can be checked against the EX_* values found
in /usr/include/sysexits.h to determine the exact error.


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>