mail body not decoded by base64_decode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all
I'm using below function to send Japanese mail, mail clients such as outlook
etc displayed Japanese text withou problems but if I viewed JP mail via
web-based mail such as Gmail, the JP subject is normally displayed, however
the JP body still base64 encoded strings, it still was not decoded yet.
Could anyone tell me solution to solve this?
=======================================
private static function _sendPc( $from, $to, $subject, $body, $contentType,
$charSet="shift_jis", $header="", $parameter=""){
Debugger::snap();
//make header
$headers = "From: $from\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: $contentType; charset=ISO-2022-JP\n";
//$headers .= "Content-type: $contentType; charset=SHIFT_JIS\n";
//$headers .= "Content-Transfer-Encoding: base64";
$headers .= "Content-Transfer-Encoding: quoted-printable";


// add header to mail
if( strlen( $header ) > 0 ){
$headers .= "\n";
$headers .= $header;
}

//make parameter
$parameters = $parameter;

//make subject
$subject = '=?ISO-2022-JP?B?'.base64_encode(mb_convert_encoding($subject,
'ISO-2022-JP', 'AUTO' )).'?=';
//$subject = '=?SHIFT_JIS?B?'.base64_encode($subject).'?=';
//$body = base64_encode($body);
$body = mb_convert_encoding( $body, 'ISO-2022-JP', "AUTO");

// a,b@xxxxxxxx こんなEMAILアドレスがたまにあるための回避策
$pos1 = strpos($to, ",");
$pos2 = strpos($to,"<");
if( $pos1 !== FALSE && $pos2 === FALSE ){
$to = "<" . $to .">";
}

if( $parameters != null && strlen( $parameters ) > 0 )
mail( $to, $subject, $body, $headers, $parameters );
else
mail( $to, $subject, $body, $headers,"-f" . $from );

Debugger::debug( "sended" );
return true;
}

Thanks and regards,
-- 
View this message in context: http://www.nabble.com/mail-body-not-decoded-by-base64_decode-tp23773646p23773646.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux