Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Anyway to cut back on sendmail retrys if smtp is not available? I get messages such as:
retrying in 1 seconds... retrying in 1 seconds...
and want to just have 1 retry. Basically I want it to stop trying sooner than it is doing now. Where and what can I add to my mail to do this??
my %mailnotif = ( To => 'toname@where.com', From => 'fromname@where.com', Subject => "info", Message => "stuff here.", ); $mailnotif{smtp} = '111.111.11.111'; sendmail(%mailnotif) || die "\nProblem! $Mail::Sendmail::error +\n";

Replies are listed 'Best First'.
Re: Cutting back retry attempts
by Taulmarill (Deacon) on Oct 09, 2003 at 14:32 UTC
    RTFM,
    here is the part you are interested in:
    %Mail::Sendmail::mailcfg This hash contains all configuration options. You normally edit it onc +e (if ever) in Sendmail.pm and forget about it, but you could also ac +cess it from your scripts. For readability, I'll assume you have impo +rted it. The keys are not case-sensitive: they are all converted to lowercase b +efore use. Writing $mailcfg{Port} = 2525; is OK: the default $mailcfg +{port} (25) will be deleted and replaced with your new value of 2525. . . . $mailcfg{retries} $mailcfg{retries} = 1; How many times should the connection to the same SMTP server be re +tried in case of a failure. Default: 1;