perl mime :: lite附加文本文件换行错误

时间:2015-10-07 00:28:15

标签: perl mime-mail

my @test = ("Row1", "Row2", "Row3");
my $attch = join("<cr><lf><br>\\n", @test);

$message = MIME::Lite->new(
    From     => $mailFrom ,
    To       => $address,
    Subject  => $title,
    Type     => 'text/html',
    Encoding => '8bit',
    Data     => $data
);

$message->attach(
    Type     =>'TEXT',
    Data     => $attch
);

MIME::Lite->send('smtp', $host, Timeout => 20);
$message->send;

美好的一天,我正在尝试通过电子邮件发送文件,但我无法写出正确的换行符,代码会发送附带附件的电子邮件,此附件包含下一个信息:
“ROW1&LT; CR&GT;&LT; LF&GT;&LT峰; br&GT; \ nRow2&LT; CR&GT;&LT; LF&GT;&LT峰; br&GT; \ nRow3”

我怎么能得到:
ROW1
行2
ROW3

在附件中?

1 个答案:

答案 0 :(得分:0)

$message->attach(
   Type => 'TEXT',
   Data => join('', map { "$_\n" } @test),
);