gpurusho has asked for the wisdom of the Perl Monks concerning the following question:
My Environment: Windows 2000, perl, v5.8.7
Problem: Connection to SMTP server doe not work
Error Reported :: "Failed to connect to mail server: Unknown error"
History
=========
I am trying to conect to a SMTP server to send otu emails.I have been using this script of mine for a more tha 3 months and I haven't had any problems. Starting 3 days back, I am no longer able to connect to the SMTP server and the scripts exists with te error "Failed to connect to mail server: Unknown error". The same script runs fine on another desktop. Is there some setting issues on my desktop. If so can you monks help me figure this out?
Code
========
package MAILER; BEGIN { } use MIME::Lite; use Net::SMTP; sub send_mail { ### Adjust sender, recipient and your SMTP mailhost # my ($subject, $mail_host, $messageBody, $to_address, $date, $cc_ +address, $my_file_zip) = @_; ### Send the Message MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; my $from_address = ''; ### Adjust subject and body message ### Adjust the filenames my $your_file_zip = "Report_$date.html"; ### Create the multipart container $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; ### Add the text message part $msg->attach ( Type => 'TEXT', Data => $messageBody ) or die "Error adding the text message part: $!\n"; ### Add the GIF file ### Add the ZIP file $msg->attach ( Type => 'application/zip', Path => $my_file_zip, Filename => $your_file_zip, Disposition => 'attachment' ) or die "Error adding $file_zip: $!\n"; ### Send the Message MIME::Lite->send('smtp', $mail_host,Timeout=>60); $msg->send; return 0; } return 1; END { }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SMTP Connection error
by quester (Vicar) on Jan 03, 2007 at 00:15 UTC | |
by gpurusho (Acolyte) on Jan 03, 2007 at 18:38 UTC | |
|
Re: SMTP Connection error
by ferreira (Chaplain) on Jan 03, 2007 at 10:01 UTC | |
|
Re: SMTP Connection error
by chime (Friar) on Jan 03, 2007 at 13:01 UTC |