kcantrel has asked for the wisdom of the Perl Monks concerning the following question:
Environment:
O/S: Windows 7 64 bit
Perl: ActivePerl 5.16.3
Problem:
I can't seem to get Net::SMTP to work. It fails to even attempt to connect to the mail server. I confirmed that by using 'wireshark' and noticed that no packets are leaving my computer. Here is the very basic code I am trying to use:
Failed to connect to cube (No connection could be made because the target machine actively refused it.; Net::SMTP: connect: No connection could be made because the target machine actively refused it.)
Keep in mind that I saw NO network activity with Wireshark and 'telnet' is able to connect to port 25. Oh, and I have disabled the Windows Firewall. So, in my option the error message is misleading at best.
O/S: Windows 7 64 bit
Perl: ActivePerl 5.16.3
Problem:
I can't seem to get Net::SMTP to work. It fails to even attempt to connect to the mail server. I confirmed that by using 'wireshark' and noticed that no packets are leaving my computer. Here is the very basic code I am trying to use:
use strict; use warnings; use Net::SMTP; use Net::FTP; my $server = "cube"; my $smtp = Net::SMTP->new(Host => $server, Debug => 1, Timeout => 60); #my $smtp = Net::FTP->new($server, Debug => 1); if(!defined($smtp)) { die "Failed to connect to $server\n"; } print $smtp->domain,"\n"; $smtp->quit;
In the above code the call to Net::SMTP->New() always returns "undef". You can see where I tried "Net::FTP" and that one works just fine, so the underlying network routines seem to work. I also confirmed I can telnet to port 25 of the mail server, and I get the typical "welcome" response. I've tried various options and ways of calling SMTP->new but they all result in the same problem. Any ideas will be greatly appreciated.
A slight update, I just added "($!; $@)" to the die line above and it printed:Failed to connect to cube (No connection could be made because the target machine actively refused it.; Net::SMTP: connect: No connection could be made because the target machine actively refused it.)
Keep in mind that I saw NO network activity with Wireshark and 'telnet' is able to connect to port 25. Oh, and I have disabled the Windows Firewall. So, in my option the error message is misleading at best.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can't get Net::SMTP to work
by tobyink (Canon) on May 09, 2013 at 22:18 UTC | |
by kcantrel (Initiate) on May 09, 2013 at 22:35 UTC | |
by kcantrel (Initiate) on May 09, 2013 at 22:39 UTC | |
Re: Can't get Net::SMTP to work
by Krambambuli (Curate) on May 10, 2013 at 10:06 UTC | |
by kcantrel (Initiate) on May 10, 2013 at 23:28 UTC | |
by Krambambuli (Curate) on May 13, 2013 at 15:41 UTC | |
Re: Can't get Net::SMTP to work
by Anonymous Monk on Feb 24, 2014 at 10:13 UTC |
Back to
Seekers of Perl Wisdom