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

Beloved Monks,

I've just installed MIME::Lite 3.030 on an old WinXP PC running ActiveState Perl 5.20.2, and have written this code to send emails via my ISP:

use MIME::Lite; MIME::Lite->send('smtp', 'smtp.my-isp.net', Timeout => 60); $msg = MIME::Lite->new( From => '"My Name" <me@here.com>', To => '"Your Name" <you@there.com>', Subject => 'Test from WinXP', Data => 'Hi!'); $msg->send or die "Error sending email!"; print "Email sent.\n";
I run it from the cmd prompt, and if I run it every couple of seconds, about 80% of the runs work, (i.e. the script displays "Email sent." and the emails get through to the recipient), but the other 20% fail, i.e. no email is delivered and all that is displayed is this:
  SMTP mail() command failed:
  4.3.1 Insufficient system storage
See how the response doesn't include "Error sending email!".
Meanwhile, Task Manager shows me that I've got 700MB of Physical Memory available.

Any ideas what's causing this, and how I can resolve it?

Thanks.

Replies are listed 'Best First'.
Re: MIME::Lite error: 4.3.1 Insufficient system storage
by Athanasius (Archbishop) on Feb 05, 2018 at 07:27 UTC

    Hello tel2,

    ... $msg->send or die "Error sending email!"; ...

    See how the response doesn't include "Error sending email!".

    That’s because the code dies before $msg->send returns. Specifically, it dies on lines 2895-7 of MIME/Lite.pm:

    $smtp->mail( $args{From}, %opts ? \%opts : () ) or die "SMTP mail() command failed: $!\n" . $smtp->message . "\n";

    Sorry, I don’t know the cause (or the fix). But before you persevere with this module, did you notice the disclaimer in the documentation?

    WAIT!

    MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else.

    If I were you, I’d try with one (or more) of the alternative modules before putting more time into MIME::Lite.

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      Thanks for that, Athanasius!  Well explained.

      I've been using MIME::Lite for years without problem, but only on a Linux server.  This is the first time I've used it on Windows.

      If this is a server problem (as an Anonymous Monk suggests), then can I expect similar problems with other mail modules?  I would have thought so.

      (My ISP (Vodafone NZ) is getting out of the email game, due to them not being able to handle spam quantities, and they probably aren't officially supporting email sending anymore, so maybe their server is a bit (or even a byte)...stuffed, due to lack of maintenance.  I don't need a long term solution for this though.)

Re: MIME::Lite error: 4.3.1 Insufficient system storage
by Anonymous Monk on Feb 05, 2018 at 09:09 UTC
      Good point, Anonymous Monk!

      I had Googled for the error before posing (honest!), but I think my search criteria was too specific so I missed what you found.

      Thanks for your help!

      It is possible that you are simply sending too many messages, too quickly, such that the upstream mail server cannot get rid of them fast enough.
        It doesn't seem to be that I'm sending them too quickly, because I can even get that error when I send 1 email after 10 mins of sending nothing.  But it may be that my ISP's mail server is too busy with requests from other customers.
Re: MIME::Lite error: 4.3.1 Insufficient system storage
by karlgoethebier (Abbot) on Feb 05, 2018 at 15:03 UTC

    BTW, see also Email::Stuffer to replace MIME::Lite. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: MIME::Lite error: 4.3.1 Insufficient system storage
by Anonymous Monk on Feb 06, 2018 at 14:33 UTC
    It often works best to stash the outgoing emails in a database table that is serviced periodically by a separate daemon process. The daemon sends a certain number of emails each time. If the server sends back an error such as this one, the daemon quits trying for a while, and goes to sleep. If it wakes up, say every five minutes or so, the emails are sure to be sent "within the next ten minutes give-or-take." Trying to send the emails in, say, an HTTP page-handler can be problematic for a variety of reasons.