Jul 23, 2010, 4:50 AM
Post #1 of 2
mail: Using MIME::Lite with utf-8
i'd like to send a simple mail with attachment in perl but i have problems with the characters "ü, ä, ö, ..." (german).
Here is my code:
use MIME::Words qw(:all);
my $sendmail = "/usr/sbin/sendmail -t";
my $from = "email@example.com";
my $reply_to = "firstname.lastname@example.org";
my $subject = "Subject ü ä ö";
my $mail_message = "This is a text with ü ä and ö";
# Create new mail
my $msg = MIME::Lite->new
Subject => $subject,
From => $from,
To => 'email@example.com',
Type => 'multipart/mixed',
Charset => 'utf-8'
Type => 'TEXT',
Data => $mailtext
# Send mail
When i read this mail with Thunderbird (that uses ISO 8895-15) i can't read ä, ü and ö. But when i change the view in my Thunderbird to "utf-8" it looks fine.
Is the code right like i have written it? How can i do that the mail arrives as a utf-8 mail in the mailclients?
Thank you for your answers and have a nice weekend...