IsSMTP(); // G?i d?n class x? lý SMTP
$mail->Host = "smtp.gmail.com"; // tên SMTP server
//$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // S? d?ng dang nh?p vào account
$mail->Host = "smtp.gmail.com"; // Thi?t l?p thông tin c?a SMPT
$mail->Port = 25; // Thi?t l?p c?ng g?i email c?a máy
$mail->Username = "hoangbienit@gmail.com"; // SMTP account username
$mail->Password = "matkhau"; // SMTP account password
//Thiet lap thong tin nguoi gui va email nguoi gui
$mail->SetFrom('hoangbienit@gmail.com','FETP VIET NAM');
//Thi?t l?p thông tin ngu?i nh?n
//$mail->AddAddress("aguyot@aamp.org", "Management AMP ORDER");
//$mail->AddAddress("bhoang@aamp.org", "Management AMP ORDER");
//Tao danh sach nhan email
$result = @mysql_query("select * from epivac_submit_email");
while($row = @mysql_fetch_array($result))
{
$email = $row["email"];
$mail->AddAddress($email,"Visitor");
}
//Thi?t l?p email nh?n email h?i dáp
//n?u ngu?i nh?n nh?n nút Reply
$mail->AddReplyTo("hoangbienit@gmail.com","FETP VIET NAM");
/*=====================================
* THIET LAP NOI DUNG EMAIL
*=====================================*/
$mail->IsHTML(true);//send email html
//Thi?t l?p tiêu d?
$mail->Subject = "FETP VIET NAM";
//Thi?t l?p d?nh d?ng font ch?
$mail->CharSet = "utf-8";
//Thi?t l?p n?i dung chính c?a email
//lay noi dung trong bang csdl
$result_node = @mysql_query("select nid, title, created AS node_created,
DATE_FORMAT((FROM_UNIXTIME(created) + INTERVAL 7200 SECOND), '%Y%m%d') from epivac_node where created >= CURRENT_TIME - 604800");
while($row = @mysql_fetch_array($result_node))
{
$body = ''.$row["title"]."
";
$mail->Body = $body;
print $mail->Body = $body;
}
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;//"Can not send email!";
}
else{
header("Refresh: 2; url='index.php'");
}
?>