Reputation: 4907
I'm trying to send an email using perl's Net::SMTP module, and I have some code that looks like this:
my $host = 'mail.server.com';
my $port = 00;
my $smtp = new Net::SMTP("$host:$port") or return 1;
$smtp->mail('[email protected]') or return 1;
$smtp->to('[email protected]') or return 1;
$smtp->data() or return 1;
$smtp->datasend("Subject: blah, blah\n\n");
$smtp->datasend($message);
$smtp->dataend() or return 1;
$smtp->quit();
The problem is, it returns after trying to set the 'to' value, and I'm completely stumped as to why. Any ideas?
FWIW, I'm not a perl developer. I'm trying to cleanup the styling of the email, and just need to get it to send so I can evaluate my changes.
Upvotes: 1
Views: 654
Reputation: 77896
Chanhe your To
part
$smtp->to('[email protected]') or return 1;
EDIT:
In that case do some more changes and see if it helps
use strict;
use warnings;
my $host = 'mail.server.com';
my $port = '00';
my $smtp = new Net::SMTP($host:$port) or
die "Could not connect to server!\n" unless $smtp;
//Rest of the code as is
Upvotes: 1