z/OS Tools & Language

Expand all | Collapse all

Perl 5.22.0 Net::SMTP function hangs at dataend()

  • 1.  Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 07-18-2016 14:50

    Running perl 5.22.0 on z/OS 2.2 RSU1605. The SMTP mail function does not complete at dataend(); appears to hang and no mail is sent.

    Works correctly using perl 5.8.7 from IBM Ported Tools. Fails on perl 5.16.2 as well.

    Basically using this sample program provided in the SMTP file to recreate the failure:

    #!/usr/local/bin/perl -w

    use Net::SMTP;

    $smtp = Net::SMTP->new(‘mailhost’);

    $smtp->mail($ENV{USER});
    if ($smtp->to(‘postmaster’)) {
    $smtp->data();
    $smtp->datasend(“To: postmaster\n”);
    $smtp->datasend("\n");
    $smtp->datasend(“A simple test message\n”);
    $smtp->dataend();
    } else {
    print "Error: ", $smtp->message();
    }

    $smtp->quit;

    We change “mailhost” to our smtp mail server and “postmaster” to "xx.yyyyy@company.com" so mail comes to tester. Also the replaced #!/usr/local/bin/perl -w
    to
    #!/shared/RSPTz/ported/perl522/bin/perl -w

    After failure reproduced, I replaced
    $smtp = Net::SMTP->new(‘mailhost’);
    with
    $smtp = Net::SMTP->new(‘mailhost’, Debug => 1,);

    This change allowed me to determine that all works until the program gets to the dataend() statement.



  • 2.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 07-20-2016 09:13

    Greetings, Ed. Thank you for the report. We are looking into the problem, but it will be several days before we will have a response for you.



  • 3.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 12-01-2016 22:09

    It’s been months. Any work being done on Perl?



  • 4.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 02-08-2017 13:26

    Still looking for some response to my report of Perl 5.22 and SMTP hang.



  • 5.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 02-24-2017 16:59

    I’m really sorry this has lingered this long.

    I have been able to reproduce the behavior you observed: the script works with perl 5.8.7 from IBM Ported Tools, does not work with the latest version of perl. I’ll be opening an internal bug report for this. I can’t give you an ETA for a fix, though.

    – Jerry



  • 6.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 03-15-2017 19:14

    Very much appreciate the confirmation that it’s a reproducible problem. Look forward to a resolution.



  • 7.  RE: Perl 5.22.0 Net::SMTP function hangs at dataend()

    Posted 07-08-2020 15:02

    I landed here through a google search for the same issue after scouring for too long… I ended up doing a somewhat hacky workaround with gmail. Instead of sending:

    $smtp->dataend;
    $smtp->quit
    

    send:

    $smtp->datasend("\r\n\r");

    Gmail will then return a 250 OK for data, and close the connection right after with a 221:

    Net::SMTP::_SSL=GLOB(0x5608b7ee1270)<<< 250 2.0.0 OK  1594234698 cq7sm276535edb.66 - gsmtp
    Net::SMTP::_SSL=GLOB(0x5608b7ee1270)>>> QUIT
    Net::SMTP::_SSL=GLOB(0x5608b7ee1270)<<< 221 2.0.0 closing connection cq7sm276535edb.66 - gsmtp