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

I have Perl scripts running 24x7 on three different severs. The scripts perform different functions, such as importing data, creating reports, etc. However, the last thing each script does is send me an e-mail alert using the email::stuffer CPAN module. Here is a snippet of the code:


Email::Stuffer->from ($From) ->to ($To) ->cc ($CC) ->bcc ($BCC) ->subject ($Subject) ->text_body($Body) ->transport('SMTP', { host => '[address of my co +mpanyís mailrelay]' }) ->send;

One of the scripts has been running since 2006 on a windows server. Another since approximately 2014 on a linux server and the third script was created in October 2018 on a windows server. Therefore, the CPAN versions are different. I.E. the CPAN versions on the oldest server (2006) and newest (2018) are different, but the e-mails have *always* been sent.


Starting on April 14, 2020, the e-mail alerts from all three servers were not consistently arriving in my Outlook inbox. In other words, the e-mails would arrive just fine, then suddenly stop. A short time later, usually between 15 to 75 minutes later, the e-mails would start arriving again. Even though the scripts run 24x7, the outages always occur somewhere between 11:45 AM and 1:30 PM. I did verify that the data imports worked and the reports were generated. To simplify matters, I created a script that does nothing but send a "Hello World" message.


At first, I thought there was something wrong on the mailrelay server, but NetOps investigated and did not find anything wrong. NetOps provided a spreadsheet showing the inbound requests and sure enough, my e-mails were not on the list.


I added additional logic to the Perl script to record what was happening. Per the below, the e-mail at 12:01 PM was sent OK, but the e-mail at 12:16 PM was not.


2020-04-29 12:01:02 Begin test e-mail

2020-04-29 12:01:03 Email sent - **return code: Email::Sender::Success__WITH__Email::Sender::Role::HasMessage**=HASH(0x3617838)

2020-04-29 12:01:03 Done with test e-mail


2020-04-29 12:16:02 Begin test e-mail

2020-04-29 12:16:03 Email sent - **return code:**

2020-04-29 12:16:03 Done with test e-mail


I brought in a fresh copy of the CPAN email::stuffer on one of the older windows servers, but that has not made any difference. According to the CPAN documentation, there are dependencies (Carp, Email::MIME, Email::MIME::Creator, Email::Sender::Simple, File::Basename, Module::Runtime, Params::Util, Scalar::Util, strict, warnings), but I didnít see those updated and assume that is OK.


Has anyone seen this issue before? Any ideas on how to proceed would be greatly appreciated.


Thanks,
Brian

Replies are listed 'Best First'.
Re: email::stuffer not always sending messages
by johngg (Canon) on Apr 29, 2020 at 20:43 UTC

    I think you are saying that all three scripts, which are on three different platforms, started having intermittent email delivery problems at the same time. I find it hard to believe that the failures are anything to do with your scripts. If one had gone wrong, then possibly; two would be a puzzling coincidence but all three failing really smells of some external change. I would ask the relevant bods to look in the change logs to see what altered on 14 April, 2020 and would also ask which jobs, if any, kick off at around midday. I would not start altering the scripts or their dependencies until I had answers to those questions as you might be introducing problems into scripts that aren't actually broken!

    Cheers,

    JohnGG

Re: email::stuffer not always sending messages
by 1nickt (Abbot) on Apr 29, 2020 at 20:21 UTC