よくあるパターンなのですが、PEARとか使えない環境のため
<?php 
 mb_internal_encoding( "UTF-8");
 mb_language("Japanese");
header("Content-Type: text/html; charset=UTF-8");
// UTF-8
if (my_email("atesaki@example.com")){
  print "メールを送信しました。";
}else{
  print "メールの送信に失敗。";
}
function my_email ($to) {
 $from = mb_encode_mimeheader("送信者") . "<from@example.net>";
 $sbj = "タイトル";
 $msg = "本文です。";
 $header = "From: {$from}";
 return mb_send_mail($to , $sbj , $msg , $header);
}
?>
No comments:
Post a Comment