기존에 누군가(?)가 만들어둔 메일 발송 함수를 utf-8 인코딩을 사용하도록 수정.
다음 함수 사용시 제목과 보내는사람까지 모두 utf-8 & base64 로 인코딩된다.
한글 및 일본어 발송시 모두 문제 없고, 일본내 일반 핸드폰으로 메일 발송시에도 일본어가 깨지지 않고 도착하는것을 확인했음. SJIS 써야 할줄알았는데 UTF8 도 잘 받더라..
function mailto($MAIL_FROM_NAME,$MAIL_FROM,$MAIL_TO,$MAIL_SUBJ,$body)
{
$mailheaders = "Return-Path: <$MAIL_FROM> \r\n";
$mailheaders .= "From: =?utf-8?B?".base64_encode($MAIL_FROM_NAME)."?= <{$MAIL_FROM}>\r\n";
$mailheaders .= "X-Mailer: JOYNET Interface\r\n";
$boundary = "--------" . uniqid("part");
$mailheaders .= "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-Type: multipart/alternative; boundary=\"=_NextPart_$boundary\"";
$bodytext = "This is a multi-part message in MIME format.\r\n\r\n";
$bodytext .= "--=_NextPart_$boundary\r\n";
$bodytext .= "Content-Type: text/plain; charset=utf-8\r\n";
$bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
$bodytext .= ereg_replace("(.{80})","\\1\r\n",base64_encode(strip_tags($body))) . "\r\n\r\n";
$bodytext .= "--=_NextPart_$boundary\r\n";
$bodytext .= "Content-Type: text/html; charset=utf-8\r\n";
$bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
$bodytext .= ereg_replace("(.{80})","\\1\r\n",base64_encode(stripslashes($body)));
$bodytext .= "\r\n\r\n--=_NextPart_$boundary--\r\n";
$result = mail($MAIL_TO, '=?utf-8?B?' . base64_encode($MAIL_SUBJ) . '?=',$bodytext,$mailheaders);
return $result;
}