01.
$mail
=
new
PHPMailer ();
02.
$mail
->CharSet =
"UTF-8"
;
03.
$mail
->IsSMTP ();
04.
$mail
->SMTPDebug = 0;
05.
$mail
->SMTPAuth = true;
06.
$mail
->Host =
"mail.tu.ac.th"
;
07.
$mail
->Port = 25;
08.
$mail
->Username =
"myaccount@tu.ac.th"
;
09.
$mail
->Password =
"mypassword"
;
10.
11.
$mail
->SetFrom (
"sirapop2@tu.ac.th"
,
$name
);
12.
$mail
->AddReplyTo (
"sirapop2@tu.ac.th"
,
$name
);
13.
$mail
->Subject =
$subject
;
14.
15.
$mail
->MsgHTML (
$body
);
16.
17.
$mail
->AddAddress (
$email
,
$mentor_name
);
18.
19.
if
(!
$mail
->Send ()) {
20.
echo
"Mailer Error: "
.
$mail
->ErrorInfo;
21.
}
else
{
22.
echo
"success"
;
23.
}