I am trying to get Net:SMTP to work in perl, and I am not having any luck everything seems to be sending ok, but the email is not being recieved. I am very new with Perl, but am trying to get this working for functionality with a batch jpg to pdf conversion to (eventually) email attachments:
testmail.pl
The debug info is as follows:
It looks like the testmail.pl script opens smtp momentarily to send, but does not actually send a message to my mailbox. this and that are replaced with username and server obviously. It is my isp mail server, this should still work correct (My ISP server does not use AUTH. is there something that I am missing.
testmail.pl
Code:
use Net::SMTP;
$smtp = Net::SMTP->new(
'mail.that.com' ,
Hello => 'mail.that.com',
Timeout => 30,
Debug => 1,
);
# -- Enter email FROM below. --
$smtp->mail('this@that.com');
# -- Enter email TO below --
$smtp->to('this@that.com');
$smtp->data();
#This part creates the SMTP headers you see
$smtp->datasend("To: this\@that.com\n");
$smtp->datasend("From: this\@that.com\n");
$smtp->datasend("Content-Type: text/html \n");
$smtp->datasend("Subject: A Test Message");
# line break to separate headers from message body
$smtp->datasend("\n");
$smtp->datasend("Here is my test message body");
$smtp->datasend("\n");
$smtp->dataend();
$smtp->quit;
The debug info is as follows:
Code:
C:\>perl testmail.pl
Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>> Net::Cmd(2.26)
Net::SMTP>>> Exporter(5.58)
Net::SMTP>>> IO::Socket::INET(1.29)
Net::SMTP>>> IO::Socket(1.29)
Net::SMTP>>> IO::Handle(1.25)
Net::SMTP=GLOB(0x19e6018)<<< 220 mail.that.com ESMTP
Net::SMTP=GLOB(0x19e6018)>>> EHLO mail.that.com
Net::SMTP=GLOB(0x19e6018)<<< 250-mail.that.com
Net::SMTP=GLOB(0x19e6018)<<< 250-8BITMIME
Net::SMTP=GLOB(0x19e6018)<<< 250 SIZE 16777216
Net::SMTP=GLOB(0x19e6018)>>> MAIL FROM:
Net::SMTP=GLOB(0x19e6018)<<< 250 sender ok
Net::SMTP=GLOB(0x19e6018)>>> RCPT TO:
Net::SMTP=GLOB(0x19e6018)<<< 250 recipient ok
Net::SMTP=GLOB(0x19e6018)>>> DATA
Net::SMTP=GLOB(0x19e6018)<<< 354 go ahead
Net::SMTP=GLOB(0x19e6018)>>> To: this@that.com
Net::SMTP=GLOB(0x19e6018)>>> From: this@that.com
Net::SMTP=GLOB(0x19e6018)>>> Content-Type: text/html
Net::SMTP=GLOB(0x19e6018)>>> Subject: A Test Message
Net::SMTP=GLOB(0x19e6018)>>> Here is my test message body
Net::SMTP=GLOB(0x19e6018)>>> .
Net::SMTP=GLOB(0x19e6018)<<< 250 ok: Message 231350739 accepted
Net::SMTP=GLOB(0x19e6018)>>> QUIT
Net::SMTP=GLOB(0x19e6018)<<< 221 mail.that.com
It looks like the testmail.pl script opens smtp momentarily to send, but does not actually send a message to my mailbox. this and that are replaced with username and server obviously. It is my isp mail server, this should still work correct (My ISP server does not use AUTH. is there something that I am missing.