G'day perlpearls,
Welcome to the monastery.
I agree with derby's comments above.
I was interested to see how this might be achieved with MIME::Lite so I ran some tests.
Having now seen your subsequent response, I realise that this isn't what you were after; however, someone might find it useful.
Here's my test code:
$ perl -Mstrict -Mwarnings -e '
use utf8;
use MIME::Lite;
package MIME::Lite::IO_Handle {
no warnings "redefine";
sub print {
my $self = shift;
binmode $$self => ":utf8";
print {$$self} @_;
}
};
MIME::Lite::->new(
To => "ken",
From => "ken",
Type => "text/plain; charset=utf8",
Subject => "\x{263a} Happy days!",
Data => "Testing 1 2 3",
)->send;
'
Notes:
-
use utf8; — because there's a Unicode character in the source code.
-
package MIME::Lite::IO_Handle { ... } — to deal with message "Wide character in print at /.../MIME/Lite.pm line 3164 ...". The only change to the original method is the addition of binmode $$self => ":utf8";.
-
\x{263a} — that's a smiley face. (The sad face \x{2639} also worked.)
Here's the mail that arrived:
$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/ken": 1 message 1 new
>N 1 ken@ganymede.localho Thu Jun 6 11:21 19/638 "☺ Happy days!"
?
Message 1:
From ken@ganymede.localhost Thu Jun 6 11:21:44 2013
X-Original-To: ken
Delivered-To: ken@ganymede.localhost
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf8
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.029 (F2.84; T1.38; A2.12; B3.13; Q3.13)
Date: Thu, 6 Jun 2013 11:21:44 +1000
To: ken@ganymede.localhost
From: ken@ganymede.localhost
Subject: ☺ Happy days!
Testing 1 2 3
?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|