Glenn
Thanks for the reply. The local smtp server listens on port 24. The domain is enersave.ca. The router forwards smtp to the local machine.


So if you send an email to [EMAIL PROTECTED], you get routed through dyndns.org where the MX records are set to port 24. When I send an email out from the local machine, I have to tell the email client to use Port 24 for the smtp server.

So, I thought that all I had to do was to set
my $smtp = Net::SMTP->new('enersave.ca', LocalPort=>'24');
To get a connection. This does not work, so I added in the LocalAddr
my $smtp = Net::SMTP->new('enersave.ca', LocalAddr=>'192.168.1.11', LocalPort=>'24');
Again, this does not work.


If I reset the local smtp server to use port 25, then the following works.
my $smtp = Net::SMTP->new('enersave.ca');


The reason 25 works is that your locally installed SMTP host is listening on port 25 (probably). The port has to be configured the same on both ends of a connection... you can kind of think of IP and port numbers like a business telephone number with an extension. If you want to reach Mary at Acme Widgets, you first dial 192.168.1.11 (if that is the IP address of Acme Widgets), and then ask for extension 25 (if that is Mary's port number). Guess what? If you ask for extension 26, you will get Stacey, and she has no clue how to handle Mary's requests, so you will get errors, and if you ask for extension 24, you will find it is not connected to anyone, so you will get errors. Or something like that. Now if Mary switches cubicles, and her new cubicle is extension 24, then you need to ask for extension 24 henceforth.

So to complete the analogy, your computer is Acme Widgets, Mary is your SMTP server, and what port did you configure it to use?

On approximately 11/6/2003 7:04 AM, came the following characters from
the keyboard of Chris Jones:
I have a script for sending emails:
my $smtp = Net::SMTP->new($smtphost, LocalAddr=>'192.168.1.11', LocalPort=>'24');
if( defined( $smtp ) )
{
print "Okay\n";
}
else
{
print "Bad\n";
}
# First the envelope bits
$smtp->mail("$from");
$smtp->to("$to");
# Now for the message itself
$smtp->data();
$smtp->datasend("From: $to\n");
$smtp->datasend("To: $from\n");
$smtp->datasend("Subject: IP \n");
$smtp->datasend("\n");
$smtp->datasend("IP Changed: was XXXX, now: YYY\n");
$smtp->dataend();
$smtp->quit;
The smtp host is installed locally.
If I use port 24 with the above I can't get a connection.
The script works fine with port 25 (the default) and my $smtp=Net::SMTP->new($smtphost);


Chris Jones, P. Eng.
14 Oneida Avenue
Toronto, ON M5J 2E3
Tel. 416 203-7465
Fax. 416 203-8249

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

-- Glenn -- http://nevcal.com/ =========================== Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. -- Bill Gates

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Chris Jones, P. Eng.
14 Oneida Avenue
Toronto, ON M5J 2E3
Tel. 416 203-7465
Fax. 416 203-8249



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to