-
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 (); Send via SMTP
- $mail->host = "smtp.163.com"; SMTP servers
- $mail->smtpauth = true; Turn on SMTP authentication
- $mail->username = "Jessiejl"; SMTP username Note: Normal mail authentication does not need to add @ domain name
- $mail->password = "1983106"; SMTP Password
$mail->from = ""; Sender Mailbox
- $mail->fromname = bbs.it-home.org; Sender, Scripting Academy
- $mail->charset = "GB2312"; Specify the character set here!
- $mail->encoding = "base64";
$mail->addaddress ($sendto _email, $user _name);//recipient mailbox and name
- $mail->addreplyto ("", "China Capital Management Network");
$mail->wordwrap = 50; Set word Wrap
- $mail->addattachment ("/var/tmp/file.tar.gz");//Attachment Accessories 1
- $mail->addattachment ("/tmp/image.jpg", "new.jpg"); Annex 2
- $mail->ishtml (TRUE); Send As HTML
- $mail->subject = $subject;
Message content can be sent directly to HTML file
- $mail->body = <<<>
- Treasurery Online Weekly
-
- EOT;
- $mail->altbody = "text/html";
- if ($mail->send ())
- {
- Info_write ("Ok.txt", "$user _name sent successfully");
- }
- else {
- Info_write ("Falied.txt", "$user _name failure, error message $mail->errorinfo");
- }
- }
- Send Email function end
Write send result function, error log record
- function Info_write ($filename, $info _log)
- {
- $info. = $info _log;
- $info. = "\ r \ n";
- $fp = fopen ($filename, a);
- Fwrite ($fp, $info);
- Fclose ($FP);
- }
Timed jump page function where 1000 is the time, 1 seconds, you can customize
- function redirect ($url)
- {
- echo "";
- }
Read the text email address you can also read the database
- $filename = "Email.txt";
- $fp = fopen ($filename, "R");
- $contents = Fread ($fp, FileSize ($filename));
- $list _email=explode ("\ r \ n", $contents);
- $len =count ($list _email);
- Fclose ($FP);
Parameter description (Sent to, message subject, message content, additional information, user name)
- $i = $_get[' action '];
- $i + +;
- if ($i < $len)
- {
- $rs =explode ("@", $list _email[$i]);
- $user _name = $rs [' 0 '];
- echo "Sending {$i} ({$list _email[$i]}) Mail ... {$user _name} ";
- Smtp_mail ($list _email[$i], ' treasurery Online weekly 12th ', $body, ' http://bbs.it-home.org/', $user _name);
- Redirect ("action= $i");
- }
- else {
- echo "All messages sent";
- Exit
- }
- ?>
Copy CodeNote: Read article Email.txt, can also be directly QQ number, each line a number, and then use Fget () read each line QQ number, Finally in addition QQ mailbox suffix @qq.com can, in fact, PHP bulk Mail is very simple, because the company needs PHP bulk Mail, so recently in a PHP bulk program system, you can freely set up a number of bulk mailbox, so that mass quantity there is guaranteed, all the settings are desktop, very intuitive operation! The above php bulk mail, a mass mailing number test between 100-200 and in the local mass can not upload online space! |