Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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:
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.

In reply to Can't get Net::SMTP to work by kcantrel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-29 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (74 votes). Check out past polls.

    Notices?