perl: August 2006 Archives

Sending Japanese Characters Using MIME::Lite

|
Took me a while to figure this one out, but it turns out to be very simple: just make sure you have charset=utf-8 set in the Type argument you pass to your new $msg object and Japanese characters appear fine in the received email.

For example, a simple plain text message:

        $msg = MIME::Lite->new(
From => $from,
To => $to,
Reply-to => $from,
Subject => $subject,
Type => 'text/plain; charset=utf-8',
Data => $textmessage,
);
Making sure you have the charset defined appears to solve the problem (and you can do that on HTML and multpart messages). If you are sending HTML, make sure the meta http-equiv="content-type" tag in the document head is also set to UTF-8 as well to stop email clients from gettingconfused by which content type to use.

About this Archive

This page is a archive of entries in the perl category from August 2006.

perl: September 2006 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.21-en