vitoco has asked for the wisdom of the Perl Monks concerning the following question:
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SMTP and SSL timeout problem
by Bod (Parson) on Jun 09, 2023 at 20:21 UTC | |
by vitoco (Hermit) on Jun 09, 2023 at 22:37 UTC | |
|
Re: Net::SMTP and SSL timeout problem
by hippo (Archbishop) on Jun 09, 2023 at 21:56 UTC | |
by vitoco (Hermit) on Jun 10, 2023 at 00:19 UTC | |
|
Re: Net::SMTP and SSL timeout problem
by vitoco (Hermit) on Jun 10, 2023 at 03:47 UTC | |
by cavac (Prior) on Jun 13, 2023 at 09:22 UTC | |
by NERDVANA (Priest) on Jun 16, 2023 at 00:38 UTC |