By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,932 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,932 IT Pros & Developers. It's quick & easy.

Email server timing out in email script

P: n/a
I have a perl script running on machine A, a web server. A visitor
completes certain pieces of data and these are compiled into two emails, one
addressed to the visitor and copied to the site owner, the other addressed
to the webmaster and including cookie and timing data for debugging.

The email is sent by machine B which is the email server for the domain.
Here are some config values for the perl script, names have been changed to
protect the innocent.

my $smtp_server = "pennyblack";
my $smtp_domain = "fred.fred.fred.fred";
my $MailFrom = "domain\@fred.fred.fred";
my $MailTo = "owner\@fred.fred.fred";

The opening part of the perl script is as follows:

sub psendmail()

use Net::SMTP;

# connect to an SMTP server
$smtp = Net::SMTP->new( $smtp_server, Hello => $smtp_domain, Timeout =>
10, Debug => 1);
if ( !$smtp ) { return 1; }
die "Couldn't connect psendmail to email server" unless $smtp;

$smtp->mail( $MailFrom); # use the sender's real address here
$smtp->to( $MailTo); # recipient's real address
$smtp->data(); # Start the mail

# Send the header.
$smtp->datasend("To: $MailTo\n"); # address in the email view
$smtp->datasend("From: $MailFrom\n"); #address in the email view

And here is the end of the process.

$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection

return 0;
The email server is being opened in debug while I fix some issues, and the
short timeout is because of the following messages in the log, which had
been around 2 minutes each prior to my changing them.

Net::SMTP>>> Net::Cmd(2.24)
Net::SMTP>>> Exporter(5.57)
Net::SMTP>>> IO::Socket::INET(1.27)
Net::SMTP>>> IO::Socket(1.28)
Net::SMTP>>> IO::Handle(1.23)
Net::SMTP=GLOB(0x1ab6c08)<<< 220 fred.fred.fred.fred ESMTP MailEnable
Service, Version: 0-1.17- ready at 02/04/05 18:14:25
Net::SMTP=GLOB(0x1ab6c08)>>> EHLO fred.fred.fred.fred
Net::SMTP=GLOB(0x1ab6c08)<<< 250-fred.fred.fred.fred [], this
server offers 4 extensions
Net::SMTP=GLOB(0x1ab6c08)<<< 250-AUTH LOGIN
Net::SMTP=GLOB(0x1ab6c08)<<< 250-SIZE 5120000
Net::SMTP=GLOB(0x1ab6c08)<<< 250-HELP
Net::SMTP=GLOB(0x1ab6c08)<<< 250 AUTH=LOGIN
Net::SMTP=GLOB(0x1ab6c08)>>> MAIL FROM:
Net::SMTP=GLOB(0x1ab6c08)<<< 250 Requested mail action okay, completed
Net::SMTP=GLOB(0x1ab6c08)>>> RCPT TO: [Fri Feb 4 18:14:36 2005]
Net::SMTP=GLOB(0x1ab6c08): Timeout at C:/ .. obfuscated path ..
/cgi-bin/applymail.cgi line 210
Net::SMTP=GLOB(0x1ab6c08)>>> DATA [Fri Feb 4 18:14:46 2005] applymail.cgi:
Net::SMTP=GLOB(0x1ab6c08): Timeout at C:/ .. obfuscated path ..
/cgi-bin/applymail.cgi line 211
Net::SMTP=GLOB(0x1ab6c08)>>> To: ow***@fred.fred.fred
Net::SMTP=GLOB(0x1ab6c08)>>> From: do****@fred.fred.fred

The email is being delivered, and where I have used a CC: definition on the
email to an external email service, this too has worked. This suggests the
email server is doing its job, yet the closure of the message also suggests
there is an issue. I need, at the very least, to get the time down for this
process, four timeouts on each of two mail sends means the script is taking
more than 80 seconds to run, and most of that is timeout.

Following is the closure part of the log. My apparently valid statements
above are also causing issues. There are no errors in any [part of the data

Net::SMTP=GLOB(0x1ab6c08)>>> . [Fri Feb 4 18:14:56 2005] applymail.cgi:
Net::SMTP=GLOB(0x1ab6c08): Timeout at C:/ .. obfuscated path ..
/cgi-bin/applymail.cgi line 262
Net::SMTP=GLOB(0x1ab6c08)>>> QUIT [Fri Feb 4 18:15:06 2005] applymail.cgi:
Net::SMTP=GLOB(0x1ab6c08): Timeout at C:/ .. obfuscated path ..
/cgi-bin/applymail.cgi line 263
Kind regards


Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.