-
Notifications
You must be signed in to change notification settings - Fork 0
/
sent-mail.php
36 lines (36 loc) · 1.63 KB
/
sent-mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
function sendTo($name, $mailTo,$noidung, $tieude)
{
include('class.smtp.php');
include "class.phpmailer.php";
$nFrom = "Admin Ken Play girl"; //mail duoc gui tu dau, thuong de ten cong ty ban
$mFrom = '[email protected]'; //dia chi email cua ban
$mPass = 'passs nè'; //mat khau email cua ban
$nTo = $name; //Ten nguoi nhan
$mTo = $mailTo; //dia chi nhan mail
$mail = new PHPMailer();
$body = $noidung; // Noi dung email
$title = $tieude; //Tieu de gui mail
$mail->IsSMTP();
$mail->CharSet = "utf-8";
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sever gui mail.
$mail->Port = 465; // cong gui mail de nguyen
// xong phan cau hinh bat dau phan gui mail
$mail->Username = $mFrom; // khai bao dia chi email
$mail->Password = $mPass; // khai bao mat khau
$mail->SetFrom($mFrom, $nFrom);
$mail->AddReplyTo('[email protected]', 'Admin Ken Play girl'); //khi nguoi dung phan hoi se duoc gui den email nay
$mail->Subject = $title;// tieu de email
$mail->MsgHTML($body);// noi dung chinh cua mail se nam o day.
$mail->AddAddress($mTo, $nTo);
// thuc thi lenh gui mail
if(!$mail->Send()) {
return 0;
} else {
return 1;
}
}
?>