S
Simon Andrews
Firstly let me say that I realise that this may not be a Perl issue, but
I think it must have some connection to the way that Net::SMTP works, so
bear with me!
I'm trying to connect to our local SMTP server. I did this ages ago
successfully but recently it's not working. Lots of stuff has changed
since it worked including new versions of perl and all modules, which
may or may not be relevant.
The problem boils down to:
#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtp = Net::SMTP->new('smtp',
Timeout => 60,
Debug => 1);
print "Result was '$smtp' from ".$Net::SMTP::VERSION;
... which gets me:
Result was '' from 2.29 (plus an uninitialised value warning from trying
to print $smtp. It seems the connection is failing before the socket is
even created.
This is backed up by:
Connect failed
OK, so it seems the smtp server is blocking me.
However. If I run a local mail program (Thunderbird) on this machine
and point it to the same SMTP server on the same port it can send
messages successfully. I'm completely at a loss to explain how what
Thunderbird is doing could be any different to what I'm doing in the script.
A few things to rule out:
There is no authorisation needed on the server. Thunderbird is set up
not to provide any credentials.
Running the same script as above from a linux box in the same IP range
works as expected, it can also telnet in correctly. All windows boxes
I've tried fail. I've tried setting $/ to \012 in case that had any
bearing, but to no avail.
Our server admin swears that there are no rules in place on the server
to block this machine from connecting.
There is no local firewall on this machine which might selectively block
outgoing packets.
I've also tried all of this using IP addresses rather than host names.
No change in outcome.
Is there any possibility that there's something in the way perl is
creating the initial connection which could be different to what a
standalone mail program would be doing? I'm really at a loss as to how
to debug this.
Simon.
I think it must have some connection to the way that Net::SMTP works, so
bear with me!
I'm trying to connect to our local SMTP server. I did this ages ago
successfully but recently it's not working. Lots of stuff has changed
since it worked including new versions of perl and all modules, which
may or may not be relevant.
The problem boils down to:
#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtp = Net::SMTP->new('smtp',
Timeout => 60,
Debug => 1);
print "Result was '$smtp' from ".$Net::SMTP::VERSION;
... which gets me:
Result was '' from 2.29 (plus an uninitialised value warning from trying
to print $smtp. It seems the connection is failing before the socket is
even created.
This is backed up by:
Connecting To smtp...Could not open connection to the host, on port 25:telnet smtp 25
Connect failed
OK, so it seems the smtp server is blocking me.
However. If I run a local mail program (Thunderbird) on this machine
and point it to the same SMTP server on the same port it can send
messages successfully. I'm completely at a loss to explain how what
Thunderbird is doing could be any different to what I'm doing in the script.
A few things to rule out:
There is no authorisation needed on the server. Thunderbird is set up
not to provide any credentials.
Running the same script as above from a linux box in the same IP range
works as expected, it can also telnet in correctly. All windows boxes
I've tried fail. I've tried setting $/ to \012 in case that had any
bearing, but to no avail.
Our server admin swears that there are no rules in place on the server
to block this machine from connecting.
There is no local firewall on this machine which might selectively block
outgoing packets.
I've also tried all of this using IP addresses rather than host names.
No change in outcome.
Is there any possibility that there's something in the way perl is
creating the initial connection which could be different to what a
standalone mail program would be doing? I'm really at a loss as to how
to debug this.
Simon.