01.
<?php
02.
03.
require
(
"phpMailer/class.phpmailer.php"
);
04.
05.
$fm
=
"Teerapun2012@gmail.com"
;
06.
$to
=
"pu.sisteryou@gmail.com"
;
07.
$custemail
=
$_POST
[
'email'
];
08.
09.
$subj
=
$_POST
[
'subject'
];
10.
11.
12.
$message
.=
"ชื่อ-นามสกุล: "
.
$_POST
[
'name'
].
"\n"
;
13.
$message
.=
"อีเมล์: "
.
$_POST
[
'email'
].
"\n"
;
14.
$message
.=
"หัวข้อ: "
.
$_POST
[
'subject'
].
"\n"
;
15.
$message
.=
"รายละเอียด: "
.
$_POST
[
'details'
].
"\n"
;
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
$mesg
=
$message
;
28.
29.
$mail
=
new
PHPMailer();
30.
$mail
->SetLanguage(
'en'
,
'phpMailer/language/'
);
31.
$mail
->CharSet =
"utf-8"
;
32.
$mail
->SMTPDebug = 1;
33.
34.
35.
$mail
->IsSMTP();
36.
$mail
->Mailer =
"smtp"
;
37.
$mail
->IsSMTP();
38.
$mail
->SMTPAuth = true;
39.
$mail
->SMTPSecure =
"tls"
;
41.
$mail
->Port = 587;
42.
43.
44.
$mail
->Username =
"Teerapun2012@gmail.com"
;
45.
$mail
->Password =
"***********"
;
46.
47.
48.
$mail
->From =
$fm
;
49.
$mail
->AddAddress(
$to
);
50.
$mail
->AddReplyTo(
$custemail
);
51.
$mail
->Subject =
$subj
;
52.
$mail
->Body =
$mesg
;
53.
$mail
->WordWrap = 50;
54.
55.
if
(!
$mail
->Send()) {
56.
echo
'Message was not sent.'
;
57.
echo
'ยังไม่สามารถส่งเมลล์ได้ในขณะนี้ '
.
$mail
->ErrorInfo;
58.
exit
;
59.
}
else
{
60.
echo
'ส่งเมลล์สำเร็จ'
;
61.
}
62.
?>