使用MIME :: Lite发送电子邮件Perl

时间:2010-12-28 18:47:28

标签: perl mime mime-types perl-module

我只是尝试使用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" );
}

1 个答案:

答案 0 :(得分:0)

我认为你需要pass to send() the smtp arguments