CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Net::SMTP::SSL Problem. [SOLVED]


New User

Jan 5, 2010, 6:10 PM

Post #1 of 2 (3408 views)
Net::SMTP::SSL Problem. [SOLVED] Can't Post

I have a server daemon that I wrote to accept a few commands from a client program, then based on those commands, run some image conversion utilities. While it's running the conversion it keeps track of any errors and then has a subroutine that is supposed to e-mail those errors to me. The subroutine looks like this:

sub senderror { 
my $smtp = Net::SMTP::SSL->new($smtp_server,
Port => 465,
Hello=>$smtp_domain) || die "Couldn't connect to smtp server $!";
if (!$smtp->auth($smtp_user,$smtp_pw)) {
print "Couldn't authenticate to SMTP Server: $!\n",$smtp->code,' : ',$smtp->message,"\n";
$smtp->datasend("To: $smtp_recip\n");
$smtp->datasend("From: $smtp_sender\n");
$smtp->datasend("Subject: Conversion Errors\n");
foreach my $err (@errors) {
return 0;

My problem is that when this script is running as part of the daemon I get the following output to my log file:

Net::SMTP::SSL>>> Net::SMTP::SSL(1.01) 
Net::SMTP::SSL>>> IO::Socket::SSL(1.31)
Net::SMTP::SSL>>> IO::Socket::INET(1.31)
Net::SMTP::SSL>>> IO::Socket(1.31)
Net::SMTP::SSL>>> IO::Handle(1.28)
Net::SMTP::SSL>>> Exporter(5.63)
Net::SMTP::SSL>>> Net::Cmd(2.29)

(Long pause here, like 3 minutes before the next lines show up)

Net::SMTP::SSL=GLOB(0xf9dd40)<<< 220 ESMTP Postfix
421 4.4.2 Error: timeout exceeded
Net::SMTP::SSL=GLOB(0xf9dd40)>>> EHLO

But when I copy the subroutine as it is into a test program and give it the same values for the variables as it gets in the main program it works fine.

I have tested everything to make sure that the daemon program is in fact getting the correct values before attempting the connection. To me it looks like something in the dameon program is somehow causing the Net::SMTP::SSL module to be unable to autoflush thus producing the 3 minute delay after the Net::SMTP::SSL>>> Net::Cmd(2.29) line before the timeout message appears. It's like the program is either not receiving the ESMTP Postifx line until after the server send the timeout. Like the Input is being buffered??? Is that possible?

When I run the subroutine from a standalone program it executes flawlessly and the log file has no delay.

Any ideas?

(This post was edited by BrentDavidson on Jan 6, 2010, 8:54 AM)

New User

Jan 6, 2010, 8:56 AM

Post #2 of 2 (3387 views)
Re: [BrentDavidson] Net::SMTP::SSL Problem. [SOLVED] [In reply to] Can't Post

Found the problem. I had changed $/ (End of line designator) earlier in the program to deal with some index files with a weird format and forgot to change it back when I was done.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives