Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Email Subject with Icon

by kcott (Archbishop)
on Jun 06, 2013 at 02:38 UTC ( [id://1037348]=note: print w/replies, xml ) Need Help??


in reply to Email Subject with Icon

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

? 

-- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1037348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-16 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found