0

I want to send an email with a japanese characters in subject using PHP. I can send by using jap characters in sender but when I use it in subject email does not receive. How can I fix this problem. Please help.

Thanks, Gyp

steven
  • 9
  • 2

2 Answers2

2

Use PHPmailer library, I have never had problem with UTF8 characters while I use that. http://phpmailer.worxware.com/

MrRP
  • 822
  • 2
  • 10
  • 25
  • PHPMailer is good tip! Latest version [here](http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/PHPMailer%20v5.1/). – Stano Jul 07 '12 at 18:24
1

First result of google (for "php unicode email")

Here's the code:

$headers['To'] = $to;
$headers['From'] = $from;
$headers['Content-Type'] = "text/plain; charset=utf-8";
$headers['Content-Transfer-Encoding'] = "8bit";
$b64subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
$headers['Subject'] = $b64subject;

$mail = Mail::factory('sendmail', array('host' => $host, 'port'=>$port));
$retval =  $mail->send($to, $headers, $body);
Máthé Endre-Botond
  • 4,826
  • 2
  • 29
  • 48