我只是尝试使用Perl和MIME :: Lite发送基本电子邮件,我收到以下错误:SMTP mail()命令失败:5.1.7无效的地址 这是我的代码:
#!perl
use MIME::Lite;
#Create Mail
$msg = MIME::Lite->new(
From =>'someone@someplace.com',
To =>'someone@someplace.com',
Cc =>'some@other.com',
Subject =>'Subject Test',
Data =>"Data Test"
);
#Send Mail
$msg->send( "smtp", "mail.place.com" );
感谢。
我最终解决了它:
sub EMailReport
{
use MIME::Lite;
my $theSubject = "Sub";
my $theData = "Data";
my $theEmail = MIME::Lite->new(
From =>'From@someplace.somewhere.com',
To =>'fistname.lastname@company.com',
Subject =>$theSubject,
Data =>$theData
);
$theEmail->add( "Type" => "multipart/mixed" );
$theEmail->send( "smtp", "somemail.company.com" );
}