class="php"><?php require_once("class.phpmailer.php"); function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) { $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "mail.yourdomain.com"; //$mail->SMTPDebug = 2; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "******@gmail.com"; $mail->Password = "******"; $mail->CharSet = "UTF-8"; $mail->Encoding = "base64"; $mail->AddAddress($sendto_email, $user_name); $mail->AddReplyTo("","my name is xc"); $mail->IsHTML(true); $mail->Subject = $subject; $mail->AltBody ="text/html"; $mail->MsgHTML($body); if($mail->Send()){ info_write("ok.txt","$sendto_email YES"); }else { info_write("falied.txt","$sendto_email NO,Notice $mail->ErrorInfo"); } } function info_write($filename,$info_log){ $info = ""; $info.= $info_log; $info.="\r\n"; $fp = fopen ($filename,'a'); fwrite($fp,$info); fclose($fp); } function redirect($url){ echo "<script> function redirect(){ window.location.replace('$url'); } window.setTimeout('redirect();', 15000); </script>"; } $filename = "email.txt"; $fp = fopen($filename,"r"); $contents = fread($fp,filesize($filename)); $list_email=explode("\r\n",$contents); $len=count($list_email); fclose($fp); if (@$_GET['action']) { $i = $_GET['action']; }else { $i = 0; } if ($i<$len){ $x = $i+1; $rs=explode("@",$list_email[$i]); $user_name = $rs[0]; echo "Sending {$x}封({$list_email[$i]}) E-mail......{$user_name}"; smtp_mail($list_email[$i], 'Treasurery Online', "<a href=baidu.com>百度</a>", 'http://www.treasurer.org.cn/', $user_name); redirect("?action=$x"); $i++; }else { echo "All emails sent out!"; exit; } ?>
?