【问题标题】:Perl Module - MIME::Lite::TT::HTML, is sending HTML content as an attachmentPerl 模块 - MIME::Lite::TT::HTML,将 HTML 内容作为附件发送
【发布时间】:2011-12-11 00:33:51
【问题描述】:

这是我的 Perl 脚本中的一个 sn-p:

my %params = (
  sub_name            => $sub_name, 
  asm_name            => $asm_name,
  zsm                 => $zsm,
  store               => $store,
  pin                 => $pin,
  tier                => $tier,
  avg_weekly_all      => $avg_weekly_all,
  avg_weekly_br       => $avg_weekly_brakes,
  expected_sales      => $expected_sales,
  numOfBays           => $numOfBays,
  numOfTechs          => $numOfTechs,
  estimatedJobs       => $estimatedBrakeJobs,
  brand               => $brand,
  qty                 => $qty
);

my %options = (INCLUDE_PATH => '.');

my $msg = MIME::Lite::TT::HTML->new(
  From        => 'xxx.xxxx@somecompany.com',
  To          => 'me@somecompany.com',
  Subject     => "Request (MSG ID: $id)",
  Template    => { html => 'edge14.html.tt' },
  TmplOptions => \%options,
  TmplParams  => \%params
);

$msg->attr("content-type" => "multipart/mixed");

$msg->attach(
  Type => 'text/csv',
  Path => 'out.txt',
  Filename => "brake_lift_$id" . ".csv",
  Disposition => 'attachment'
);

$msg->send or die "Unable to send message: $!";

它正在发送电子邮件(带附件)就好了,但它没有呈现电子邮件正文中的 html 内容。它以纯文本形式发送并以“ATT00001..htm”格式附加html,是的,在“htm”之前有两个点......

我做错了什么??

【问题讨论】:

标签: perl email mime


【解决方案1】:

回答了我自己的问题!注意到所有其他哈希属性都是裸词,所以我去掉了“内容类型”的引号,它就像一个魅力!

【讨论】:

    猜你喜欢
    • 2011-11-14
    • 1970-01-01
    • 1970-01-01
    • 2013-12-10
    • 2012-04-22
    • 2018-05-12
    • 2015-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多