我正忙着编写一个脚本,该脚本创建带有多部分替代部分和附件的电子邮件。现在似乎一切正常,除了普通附件,它们似乎无法在 Gmail 或 Yahoo webmail 中下载,我所有的内联图像都可用,但如果我附加任何东西,无论是简单的 .txt 文件还是 pdf,它们都是无法下载,我已将处置设置为附件。我可以在邮件中看到它。下面是我如何去做。还有什么我应该做的吗?
my $ent = MIME::Entity->build(From => $from,
To => $to,
Type => "multipart/alternative",
'X-Mailer' => undef);
if ($plain_body)
{
$ent->attach(
Type => 'text/plain; charset=UTF-8',
Data => $plain_body,
Encoding => $textEnc,
);
}
$ent->attach(Type => 'multipart/related');
$ent->attach(
Type => 'text/html; charset=UTF-8',
Data => $content,
Encoding => $htmlEnc,
);
if ($count != 0) {
for my $i (0..$count-1){
$ent->attach(Data => $attachment[$i],
Type => $content_type[$i],
Filename => $attname[$i],
Id => $cid[$i],
Disposition => $disposition[$i],
Encoding => $encoding[$i]);
}
////\ 在 Yahoo 或 Gmail 网络邮件中不可见的附件..
------------=_1371465849-18979-0
Content-Type: text/plain; name="Careways Final.txt"
Content-Disposition: attachment; filename="Careways Final.txt"
Content-Transfer-Encoding: quoted-printable