[PHP-users 16878]メール送信時に文字化け

キャスター マイルド caster_mild_49401219 @ hotmail.com
2003年 7月 22日 (火) 05:29:16 JST


$B$*$O$h$&$4$6$$$^$9!#(B
$B%-%c%9%?!<$G$9!#(B

redhat7.3 php-4.1.2-7.3.6 apache-1.3.27-2 sendmail-8.11.6-25.73
$B$r;HMQ$7$F$$$^$9!#(B

PHP$B$+$i%a!<%kAw?.;~$K!"FCDj$NJ8;z$,J8;z2=$1$7$F$7$^$$$^$9!#(B
$BNc$($P!"!V?=$79~$_!W$H8@$&J8;z$N$&$A!"!V?=!W$,!&!&!&(B
$B$^$?!"!VM=Ls!W$H$$$&;~$N!VM=Ls!W$=$N$b$N$,!"Mva$H8@$&6q9g$KJ8;z2=$1$7$F$7$^(B
$B$$$^$9!#(B

$B860x$rD4$Y$F$O$$$k$b$N$N!"%(%s%3!<%I4X78$+$J$H;W$&$N$G$9$,!"$$$+$,$G$7$g$&(B
$B$+!)(B
$B59$7$/$*4j$$$$$?$7$^$9!#(B

$B85$N%=!<%9$O!"%l%C%D$5$s$N=j$N$b$N$r;HMQ$7$F$$$^$9!#(B
$B0J2<$K!"0lIt>JN,$G%=!<%9$r$N$;$^$9!#(B

function mime_enc($usr_str,$mime=0){
  if(get_magic_quotes_gpc()) $usr_str = stripslashes($usr_str);//\$B$O<h$k(B
  $usr_str = HANtoZEN_SJIS($usr_str);
  $enc = sjis2jis($usr_str);			//JIS$B$KJQ49(B
  if($mime) $encode = "=?iso-2022-jp?B?" . base64_encode($enc) . "?=";	//B
$B%X%C%@!\%(%s%3!<%I(B
  else $encode = $enc;
  return $encode;
}

// $BCfN,(B

$body = "$B?=$79~$_$"$j$,$H$&$4$6$$$^$9!#(B\n$BM=Ls40N;!*(B\n";
$body = str_replace("\r\n", "\n", $body);	//$B2~9TJ8;z$NE}0l(B
$body = str_replace("\r", "\n", $body);
if(preg_match("/[\x80-\xA0]/",$body)){		//$BK\J8$KF|K\8l$,$"$k>l9g(BJIS$BJQ49(B
$body = mime_enc($body,0);
}
if(!mail($mail_address, $subject, $body, $head)){
echo "$B%a!<%kAw?.$,<:GT$7$^$7$?(B";
}

_________________________________________________________________
$B:#$,=\$N%/%k%^$rE0DlE*$KJ, @ O$7$^$9(B MSN $B<+F0<V(B  http://car.msn.co.jp/ 



PHP-users メーリングリストの案内