Hi, I am trying to send a plain text e-mail in perl that has utf-8 characters in it. I don't have any problems with the characters, they are as expected so I know that the utf-8 string is ok, but I can't figure out how to signal the e-mail module so that it works properly with utf-8. If I use Mail::Sendmail, the program halts with the following error: Wide character in subroutine entry at C:/Perl/site/lib/Mail/Sendmail.pm line 237. Here is the test code I have written:
use HTML::Entities; use strict; my $input = 'Не просто +'; $input = decode_entities($input); # Sendmail stuff my %mail; $mail{'Content-type'} = 'text/plain; charset="utf-8"'; $mail{smtp} = 'smtp.mycompany.com'; $mail{From} = 'server@mycompany.com'; $mail{To} = 'me@mycompany.com'; $mail{Subject} = 'Sendmail Test'; $mail{Message} = $input; use Mail::Sendmail; Mail::Sendmail::sendmail(%mail) || print STDERR $Mail::Sendmail::error +;
If I replace the sendmail code with Mail::Sender::Easy, I only get a warning, and the e-mail is fine, but I'd prefer not to have the warning: Wide character in print at C:/Perl/site/lib/Mail/Sender.pm line 1767, <GEN0> line 14.
# Sender setup use Mail::Sender::Easy qw(email); email({ smtp => 'smtp.mycompany.com', from => 'server@mycompany.com', to => 'me@mycompany.com', subject => 'Sender Test', charset => 'utf-8', _text => $input, }) || print STDERR "email() failed: $@";
Any ideas how to get either module to work without an error or warning? Thanks, Lisa

In reply to Wide characters in e-mail by lghansen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.