CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
charset problem on sending email with Mime::Lite

 



mario99ukdw
New User

Oct 18, 2016, 11:24 PM

Post #1 of 3 (3823 views)
charset problem on sending email with Mime::Lite Can't Post

I have code that need to send email with attachment. But on thunderbird the character is broken (umlaut character is not show properly). On outlook, the umlaut character is show correctly

here are the code


Code
my $msg = MIME::Lite->new( 
From => $self->{from},
To => $self->{to},
Cc => $self->{cc},
Subject => $self->{subject},
Type => 'multipart/mixed',
Charset => 'utf8',
);

$msg->attach(Type => 'TEXT', Data => 'I hope you can use this! ');

foreach my $attachment (@{$self->{attachments}}) {
my ($name, $path, $suffix) = fileparse($attachment, '\.[^\.]*');

my $attachment_type = 'text/plain';
if ($suffix eq '.idoc') {
$attachment_type = 'application/octet-stream';
} elsif ($suffix eq '.pdf') {
$attachment_type = 'application/pdf';
} elsif ($suffix eq '.p7s') {
$attachment_type = 'application/pkcs7-mime';
}
$msg->attach(
Type => $attachment_type,
Path => $attachment,
Filename => $name . $suffix,
Disposition => 'attachment'
);
}

$msg->send ('smtp', $mail_smtp_server);


do we have certain setting for thunderbird?
Attachments: Screenshot_3.png (6.16 KB)


Laurent_R
Veteran / Moderator

Oct 19, 2016, 5:10 AM

Post #2 of 3 (3819 views)
Re: [mario99ukdw] charset problem on sending email with Mime::Lite [In reply to] Can't Post

You probably need to configure Thunderbird for UTF-8 encoding.


mario99ukdw
New User

Oct 20, 2016, 2:40 AM

Post #3 of 3 (3802 views)
Re: [mario99ukdw] charset problem on sending email with Mime::Lite [In reply to] Can't Post

It is work now

I changed this line code

Code
$msg->attach(Type => 'TEXT', Data => 'I hope you can use this! ');


into this code


Code
$msg->attach(Type => 'text/html; charset=UTF-8', Data => 'I hope you can use this! ');


and the umlaut chars is show correctly on thunderbird

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives