dbmathis has asked for the wisdom of the Perl Monks concerning the following question:
Hello People,
I am inputting russian / cyrillic into an e-mail form / program I wrote and when it arrives, part of the output is mangled for the same russian / cyrillic input. For example the person inputs their name (Увеличение массы мозга) in russian / cyrillic and when the e-mail arrives the name is displayed properly in the body of the e-mail but not in the attached jpg file or the subject of the e-mail. All three are using the name that was input.
Here is the code:#================================================================ #- Send image #================================================================ # sub send_image { my $message_body; # Adjust sender, recipient and your SMTP mailhost my $from_address = $from; my $to_address = $email; # Adjust subject and body message if ( $testmode ) { $message_body = "Thank you for performing the transfer test. I +t's good until <b>$msg_body_expdate</b>.<br /><br />Visit <a href=\"h +ttp://www./specialoffer\">http://www./specialoffer</a> now to take ad +vantage of this exciting special one week offer of 10% off<br /><br / +>"; } else { $message_body = "Attached is the chi card you ordered. It's go +od until <b>$msg_body_expdate</b>."; } my $subject = "Chi-Card delivery service"; # Create the multipart container my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, BCC => $bcc, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart cont +ainer: $!\n"; # Add the text message part $msg->attach ( Type => 'text/html', Data => qq{ $message_body } ) or die "Error adding the text message part: $!\n"; # Add the excel file $msg->attach ( Type => 'image/jpeg', #Encodxing => 'base64', Path => $chicardcustomed, Filename => $filename, Disposition => 'attachment' ) or die "Error adding $chicardcustomed: $!\n"; # Now send $msg->send("sendmail") or die "Error e-mailing: $filename.\n"; } #================================================================ #- Send info #================================================================ # sub send_info { # Adjust sender, recipient and your SMTP mailhost my $from_address = $from; my $to_address = $infoemail; # Adjust subject and body message my $message_body = "<h2>The following visitor requested informatio +n.</h2><b>Name:</b> $string<br><b>E-mail:</b> $email<br>"; my $subject = "$string is requesting information."; # Create the multipart container my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, BCC => $bcc, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart cont +ainer: $!\n"; # Add the text message part $msg->attach ( Type => 'text/html', Data => qq{ $message_body } ) or die "Error adding the text message part: $!\n"; # Now send $msg->send("sendmail") or die "Error e-mailing: $!\n"; }
The output can be seen here for the image e-mail and the separate info e-mail per the code listed above.
How do I make the jpg name and e-mail subjects display in russian / cyrillic? I have been trying for days.
Best Regards, David
|
|---|