XUpload - Japanese email text and how to attach files to email

Message
Author
jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

Japanese email text and how to attach files to email

#1 Postby jimrws » Feb 05, 2008 12:11 pm

Hi,
  • 1. I'm looking to support Japanese versions of my forms so I need to display Japanese text in emails as html. Previously I've done this using

    Code: Select all

    <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
    But this just gets overwritten when the email is processed.
    Is there a way(preferably an easy one) to control charset, without changing too much code?
  • 2. I also want to attach uploaded files to the emails, is this possible to do with the existing code?
Thanks for any help.

Jim.

jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

#2 Postby jimrws » Feb 06, 2008 8:34 am

Can anyone help with these? :(

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#3 Postby PilgrimX182 » Feb 06, 2008 12:51 pm

Try this: in upload.cgi find

Code: Select all

Subject: $subject
Content-Type: text/html
and change Conent-type line to

Code: Select all

Content-Type: text/html;charset=shift_jis
at least this works 100% in browser, never tested for emails.

jimrws
Posts: 21
Joined: Feb 05, 2008 8:29 am

#4 Postby jimrws » Feb 06, 2008 1:55 pm

Thanks, that seems to work.

Any idea on my second problem above? (attaching the files to email)

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#5 Postby PilgrimX182 » Feb 07, 2008 8:42 am

This is part of source code from our internal projects to send email with file attached:

Code: Select all

use MIME::Lite;
### Create the multipart container
my $msg = MIME::Lite->new (
  From => $from_address,
  To => $to_address,
  Subject => $subject,
  Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";

### Add the text message part
$msg->attach (
  Type => 'text/html',
  Data => $body
);

### Add the attached file
$msg->attach (
   Type => 'application/octet-stream',
   Path => $save_attach_to."$title.$file_ext",
   Filename => "$file_path",
   Disposition => 'attachment'
);

### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;
We can integrate it into your code for $20 if you want.