Greetings,
I've been working on a Perl script to send email from my home computer to an email account using my domain's SMTP server. The script is:
>#!/usr/bin/perl -w
use Net::SMTP;
use Net::SMTP::SSL;
my $server_name = "mail.****";
$smtp = Net::SMTP::SSL->new($server_name, Timeout => 30, Debug =>1, Port=>465);
$smtp->auth('username+****', 'password');
my $mail_from = "user\@****";
my $mail_to = "target\@targetdomain.com";
$smtp->mail( $mail_from );
$smtp->recipient( $mail_to );
$smtp->data();
$smtp->datasend("To: target\@targetdomain.com");
$smtp->datasend("From: user\@****");
$smtp->datasend("Subject: Test from Perl\n");
$smtp->datasend("\n");
$smtp->datasend("This is a test message from Perl.\n");
$smtp->dataend();
$smtp->quit();
When run, the following output is generated:
><<< 220-server29.totalchoicehosting.com ESMTP Exim 4.44 #1 Sun, 30 Jan 2005 11:17:24 -0600
<<< 220-We do not authorize the use of this system to transport unsolicited,
<<< 220 and/or bulk e-mail.
>>> EHLO localhost.localdomain
<<< 250-server29.totalchoicehosting.com Hello localhost.localdomain [xx.xxx.xxx.xxx]
<<< 250-SIZE 52428800
<<< 250-PIPELINING
<<< 250-AUTH PLAIN LOGIN
<<< 250 HELP
>>> AUTH PLAIN c2NvdHQrc2NvdHRhbmRqdWxpZWFuZGVyc29uLmNvbQBzY290dCtzY290dGFuZGp1bGllYW5kZXJzb24uY29tA
Z1enp5bnV0cw==
<<< 235 Authentication succeeded
>>> MAIL FROM:<user@****>
<<< 250 OK
>>> RCPT TO:<target@targetdomain.com>
<<< 250 Accepted
>>> DATA
<<< 354 Enter message, ending with "." on a line by itself
>>> To: target@targetdomain.com
>>> From: user@****
>>> Subject: Test from Perl
>>> This is a test message from Perl.
>>> .
<<< 550 Administrative prohibition
>>> QUIT
<<< 221 server29.totalchoicehosting.com closing connection
Any ideas why exim is closing the connection? I appear to have authenticated properly with the system. Also, I can use SSL on port 465 and send email successfully using MS Outlook. Your help is appreciated---thanks!