kcantrel has asked for the wisdom of the Perl Monks concerning the following question:
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:
|
|---|
| 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 |