$mail = new PHPMailer(); $address=$row[1];$mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.aaa.com.cn"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "Josh"; // SMTP username $mail->Password = "password"; // SMTP password$mail->From = "[email protected]"; $mail->FromName = "Mailer"; $mail->AddAddress("$address"); $mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters $mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); // set email format to HTML $name="$row[2]"; $mail->Subject ="$name 到期了"; $mail->Body = "This is the HTML message body <b>in bold! </b>"; $mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } }
$mail = new PHPMailer();
$address=$row[1];上面代码中的$address = $row[1];
$address应该取得是email地址吧,但$row[1]好像取得的是edate,
应该改为$address = $row[2];
不知道是否能解决你的问题
还有一个队列set_time_limit(0);
while(){
我发...
sleep(n分钟);
}只是一个思路.
cho"当前时间";
echo "$datesy";
echo"<br>";
echo "第一个";
echo "$row[0]";
echo "</p>";
echo "第二个";
echo "$row[1]";
echo "</p>";当前时间
2008-07-21第一个2008-07-21
第二个2008-07-19
Message has been sent
当前时间
2008-07-21第一个2008-07-19
第二个2008-07-21Fatal error: Cannot redeclare class PHPMailer in C:\xampp\htdocs\test\phpmailer\class.phpmailer.php on line 35
2008-7-21 2008-7-19 [email protected] adfd
2008-7-15 2008-7-21 [email protected] bbcc
当前时间
2008-07-21
第一个2008-07-21第二个[email protected] has been sent当前时间
2008-07-21
第一个2008-07-19第二个[email protected] bbcc
Fatal error: Cannot redeclare class PHPMailer in C:\xampp\htdocs\test\phpmailer\class.phpmailer.php on line 35
while ($row = mysql_fetch_array($result)) {
if($datesy==$row[0] ¦ ¦ datesy==$row[1]) {
$address =","$row[2];
}
}
if($address!=''){
$address = substr($address,1);
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$address=$row[1];$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.aaa.com.cn"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "Josh"; // SMTP username
$mail->Password = "password"; // SMTP password$mail->From = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("$address");
$mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML
$name="$row[2]";
$mail->Subject ="$name 到期了";
$mail->Body = "This is the HTML message body <b>in bold! </b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}