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

Discussion in 'Perl' started by Andrzej Adam Filip, Mar 31, 2008.

  1. "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, Mar 31, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    Mailer, Newsletter script in asp/asp.net

    =?Utf-8?B?Sm9l?=, Feb 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    908
    Juan T. Llibre
    Feb 23, 2005
  2. sugapablo
    Replies:
    0
    Views:
    2,163
    sugapablo
    Sep 21, 2007
  3. Mark Creelman

    Multiple field form for this ASP mailer script

    Mark Creelman, Apr 3, 2004, in forum: ASP General
    Replies:
    3
    Views:
    548
    Steven Burn
    Apr 3, 2004
  4. Doug Parker

    Getting a mailer script to work

    Doug Parker, Apr 14, 2004, in forum: ASP General
    Replies:
    1
    Views:
    143
    Bullschmidt
    Apr 19, 2004
  5. gwmbox
    Replies:
    0
    Views:
    126
    gwmbox
    Jul 9, 2003
Loading...

Share This Page