PHP source code for mass mailing_PHP tutorial

WBOY
Release: 2016-07-21 15:05:22
Original
1211 people have browsed it

Copy code The code is as follows:

// Request PHPmailer class file
require_once("class.phpmailer.php");

//Send Email function
function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {
$mail = new PHPMailer();
$mail->IsSMTP(); >Host = "smtp.163.com"; // SMTP servers
$mail->SMTPAuth = true; ssiejl";                                              // SMTP username Note: Ordinary mail authentication does not require adding @domain name
$mail->Password = "1983106"; pieces Person's email address
$mail->FromName = "WWW.NIUTW.COM"; // Sender, such as Aimei Matching Network

$mail->CharSet = "GB2312"; Specify character set!
$mail->Encoding = "base64";

$mail->AddAddress($sendto_email,$user_name); // Recipient email and name
$mail-> AddReplyTo("","Web Home");

//$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/ tmp/file.tar.gz");                                                                     //Attachment 2
$mail->IsHTML(true); File
$mail-> ;Body = <<

Treasurery Online Weekly



;/body>

EOT;
$mail->AltBody ="text/html";
if($mail->Send())
{
info_write("ok.txt","$user_name sent successfully");
        }                                                                                                                                                   >ErrorInfo");
}
}
// End of sending Email function

// Write sending result function, error log record
function info_write($filename,$ info_log)
{
$info.= $info_log;
$info.="rn";
$fp = fopen ($filename,a);
fwrite($fp,$ info);
fclose($fp);
}

//Timed jump page function 1000 is time, 1 second, you can customize
function redirect($url)
{
           echo "
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template