Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';这是一个用于创建和发送电子邮件的良好Perl OO接口吗?_Perl_Email_Cpan - Fatal编程技术网

什么';这是一个用于创建和发送电子邮件的良好Perl OO接口吗?

什么';这是一个用于创建和发送电子邮件的良好Perl OO接口吗?,perl,email,cpan,Perl,Email,Cpan,我正在寻找一种简单(OO?)的方法来创建和发送电子邮件 差不多 $e = Email->new(to => "test <test@test.com>", from => "from <from@from.com>"); $e->plain_text($plain_version); $e->html($html_version); $e->attach_file($some_file_object); $e=Email->new(t

我正在寻找一种简单(OO?)的方法来创建和发送电子邮件

差不多

$e = Email->new(to => "test <test@test.com>", from => "from <from@from.com>");
$e->plain_text($plain_version);
$e->html($html_version);
$e->attach_file($some_file_object);
$e=Email->new(to=>“test”,from=>“from”);
$e->plain_text($plain_版本);
$e->html($html\U版本);
$e->attach_file($some_file_object);
我找到了Email::MIME::CreateHTML,它几乎在所有方面都很好,只是它似乎不支持文件附件

此外,我正在考虑将这些电子邮件写入数据库,并让cronjob在以后发送它们。这意味着我需要一个
$e->as_text()
子文件来返回整个电子邮件,包括附件,作为原始文本,我可以将其填充到数据库中。因此,我需要一种发送原始电子邮件的方式——实现这一点的好方法是什么

非常感谢

您可能会退房

您可以将消息作为字符串保存到数据库中:

### Get entire message as a string:
$str = $msg->as_string;

你必须更仔细地阅读文档,那么你的三个问题中有两个是没有意义的

Email::MIME::CreateHTML
的概要中:

my $email = Email::MIME->create_html(
显然,您会得到一个
Email::MIME
对象。有关所谓的附件,请参见方法和

Email::MIME
Email::Simple
的子类。请参见将对象序列化为文本的方法

有关发送邮件的信息,请参阅。

是电子邮件::MIME的良好包装。您不需要关心邮件的MIME结构,模块会为您完成这项工作

Email::Stuff->from     ('cpan@ali.as'                      )
            ->to       ('santa@northpole.org'              )
            ->bcc      ('bunbun@sluggy.com'                )
            ->text_body($body                              )
            ->attach   (io('dead_bunbun_faked.gif')->all,
                        filename => 'dead_bunbun_proof.gif')
            ->send;

它也有as_字符串。

我认为这可能真的很完美!我知道某处会有一个!谢谢。没有必要引入完全不同的MIME邮件库。谢谢。邮件::东西看起来很理想