Subject: | $mail->attr('content-type.charset' => 'UTF-8'); is discarded |
I'm trying to set the charset for a multipart/alternative text/html part and the header is never sent to the SMTP
server.
my $mail = MIME::Lite->new(
#FIXME we should not refer to 'ET" in our FROM email
From => $from,
To => $to,
Subject => encode('MIME-Header', $subject),
Type => 'multipart/alternative',
);
_utf8_off($html);
# MIME::Lite ignores this:
$mail->attr('content-type.charset' => 'UTF-8');
$mail->attach(
#THIS WORKS: 'Content-Type' => 'text/html; charset="utf-8"',
Encoding => 'base64',
Type => 'text/html',
Data => $html,
);
print $mail-as_string()
That program generates:
MIME-Version: 1.0
Content-Transfer-Encoding: binary
Content-Type: multipart/alternative; boundary="_----------=_13143624054730"; charset="UTF-8"
X-Mailer: MIME::Lite 3.027 (F2.73; T1.29; A2.06; B3.01; Q3.01)
Date: Fri, 26 Aug 2011 14:40:05 +0200
From: XXXXXXXXXXXXXXXXXXX
To: YYYYYYYYYYYYYYYYYYYYYYYy
Subject: v1 (charset=utf-8, base64)=?UTF-8?B?IC0gV2hhdCBpcyDtjoQ=?=? It is Perl.
=?UTF-8?B?IEFuZCDQn9C10YDQuw==?=? see this? %var%
This is a multi-part message in MIME format.
--_----------=_13143624054730
Content-Disposition: inline
Content-Transfer-Encoding: base64
Content-Type: text/html
PGgxPldoYXQgaXMg7Y6EPyBJdCBpcyBQZXJsLiBBbmQg0J/QtdGA0Ls/IHNlZSB0aGlzPyAlJXZh
ciUlPC9oMT4=
--_----------=_13143624054730--
THere's no charset set to the text/html part.