I'm trying to have a Perl script send an e-mail through an SMTP server, but the e-mail isn't coming out the way it's supposed to. I either get no data in the mail (no sender, etc.), or messed up data. I've also been unable to get ANY e-mail body.
Just a note, I don't know Perl. I've read through the basics but I've never created anything in Perl before. I'm just trying to follow tutorials with this script.
Code:
#!/usr/local/bin/perl -w
use Net::SMTP;
$smtp = Net::SMTP->new('127.0.0.1',Hello => 'Perl');
$smtp->mail("nanakixiii\@ja.nl");
$smtp->to("nanakiiiix\@gmail.com");
$smtp->data;
$smtp->datasend("From: me\@example.com");
$smtp->datasend("To: to\@domain.com");
$smtp->datasend("Subject: This is a test");
$smtp->datasend("\n");
$smtp->datasend("blahblah");
$smtp->dataend;
$smtp->quit;
The above script gets me this header:
Code:
From: @ example. comto <me>
Reply-To: "@ example. comto" <me>, "@ domain. comsubject" <to>, Thisisatest
Date: Sat, 26 Feb 2005 04:19:32 -0800 (PST)
And no body.
Any help would be appreciated.