$MailTo = 'myemail@hotmail.com' ;
$MailFrom = 'emailfrom@mywebsite.com' ;
$MailSubject = 'ทดสอบส่งอีเมลล์';
$MailMessage = 'แบบไทยๆ';
send_email($MailTo, $MailSubject , $MailMessage, $MailFrom);
//---------------------------ใช้ฟังก็ชั่นด้านล่างนี้
function send_email($MailTo, $MailSubject , $MailMessage, $MailFrom)
{
$Headers = "MIME-Version: 1.0' . \r\n";
$Headers .= "Content-type: text/html; charset=utf-8\r\n";
$Headers .= "From: ".$MailFrom." <".$MailFrom.">\r\n" ;
$Headers .= "Reply-to: ".$MailFrom." <".$MailFrom.">\r\n" ;
$Headers .= "X-Priority: 3\r\n" ;
$Headers .= "X-Mailer: PHP mailer\r\n" ;
$MailSubject = "=?UTF-8?B?".base64_encode($MailSubject)."?=";
if(mail($MailTo, $MailSubject , $MailMessage, $Headers, $MailFrom))
{
return(TRUE);
}else{
return(FALSE);
}
}
?>