Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Re: [sendmail,perl] How to catch a mailer error [perl script as sendmail.cf mailer]

 
Thread Tools Search this Thread
Old 03-31-2008, 10:24 PM   #1
Default Re: [sendmail,perl] How to catch a mailer error [perl script as sendmail.cf mailer]


"Christian" <> wrote:
> I have a Perl mailer called that way :
>
> Matmail P=/servers/apache/sites/atmail/savemsg.pl,
> F=lsDFMA5:/|@qSPhn9, S=EnvFromL/HdrFromL,
> R=EnvToL/HdrToL,
> T=DNS/RFC822/X-Unix, U=nobody,
> A=savemsg.pl $g $u
>
> Sometimes, I get the following error :
>
> Mar 31 07:32:14 black sendmail[25866]: m2V5WDq25860: to=<>,
> delay=00:00:00, xdelay=00:00:00, mailer=atmail, pri=32256, dsn=5.3.0,
> stat=unknown mailer error 255
>
> I cannot find any relevant system information about a problem at the time
> this error pops up. So here is my question : is there a way to catch a
> mailer error so that the message stays in the mail queue until it gets


"man perlfunc" states that "die" when $!==0 and $?==0 causes "exits with 255".
My guess would indicate uncaught "die" in your script perl as the most
likely culprit.

I would suggest you installing $SIG{__DIE__} handler function in your
perl to:
a) "translate" exit code 255 to a value sendmail recognizes
as listed in sysexits.h file e.g.
#define EX_SOFTWARE 70 /* internal software error */
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */

Exit code 75 would make sendmail queue message for future delivery.

b) emitting *short* problem description via STDERR (e.g. below 128 chars)

P.S.
The proper fix would be to create Sendmail::Carp CPAN module based on
CGI::Carp . Do you volunteer?

--
[pl>en: Andrew] Andrzej Adam Filip sip:
Open-Sendmail: http://open-sendmail.sourceforge.net/
The church saves sinners, but science seeks to stop their manufacture.
-- Elbert Hubbard


Andrzej Adam Filip
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46