Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Email Subject with Icon

by perlpearls (Initiate)
on Jun 05, 2013 at 22:08 UTC ( #1037312=perlquestion: print w/replies, xml ) Need Help??

perlpearls has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I tried searching here with no luck before actually posting this.

I am using MIME::Lite to send emails. However, I want to put a small image (logo) on the email subject before the actual subject.

Any ideas on how to do this is greatly appreciated.

Many Thanks

Replies are listed 'Best First'.
Re: Email Subject with Icon
by kcott (Archbishop) on Jun 06, 2013 at 02:38 UTC

    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

Re: Email Subject with Icon
by derby (Abbot) on Jun 05, 2013 at 23:01 UTC

    I'm fairly certain the subject line is text only. If you're seeing images in email subject lines, chances are it's just a unicode character.

    -derby

    Update: and there's probably some email client somewhere that will turn emoji codes to the proper unicode representation.

      Thanks for the response.

      Probably I should have made myself more clear. I was thinking in the lines of favicon which you see in the browser infront of the url.

        SMTP, the standard email protocol, does not specify support for anything like a "favicon". While there may be some email clients which add it as an extension, they are exceptions to the rule. Even if you were to arrange for your image to appear in the subject line on one mail client, the vast majority will not display it at all (indeed, many aren't even capable of displaying an image - text-only mail readers are still around) and, even among those which display it, most would probably display it elsewhere.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2022-06-25 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?