Hello.

I'm using the standard procedure of the Net::SMTP module to send emails from a Windows box with Strawberry, and it works if I use a plain SMTP connection, but when I use SSL it hangs at the dataend method (which is part of the Net::Cmd module).

I searched and found some other reports, but not a solution.

The piece of code is:

my $smtp = Net::SMTP->new(Host => $mailserver, SSL => 0, Debug => 1, + Timeout => 30); $smtp->auth($username, $password); $smtp->mail($myemail); if ($smtp->to($destemail)) { $smtp->data(); $smtp->datasend("From: $myemail\n"); $smtp->datasend("To: $destemail\n"); $smtp->datasend("Date: $date\n"); $smtp->datasend("Subject: A test\n"); $smtp->datasend("\n"); warn "(end of header)\n"; $smtp->datasend("This is a test...\n"); warn "(end of body)\n"; $smtp->dataend; warn "(dataend completed)\n"; } else { print "ERROR: ", $smtp->message(); } warn "(bye...)\n"; $smtp->quit;

With SSL=>1, debug trace shows all the messages from the (successful) authentication up to "end of body" message and hangs for a while, then a timeout message appears.

I also tried without the dataend, but the quit seems to call dataend internally and the problem persists.

What am I missing?

I don't want to hack standard mods...


In reply to Net::SMTP and SSL timeout problem by vitoco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.