我有一个具有价值的表格count
。我想发送带有附件的邮件,附件是count
值的多次。实际上我想通过if
声明发送附件检查一些因素,所以我该怎么做,请任何人帮助我吗?我的代码在这里:
<?php
echo $count;
require_once 'session.php';
require_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = file_get_contents('mail.html');
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("lipsa.auroin@gmail.com","First Last");
$mail->SetFrom('lipsa.auroin@gmail.com', 'First Last');
$mail->AddReplyTo("lipsa.auroin@gmail.com","First Last");
$email=$_POST['email2'];
$addresses = explode(',', $email);
foreach ($addresses as $address){
$address = trim($address);
$mail->AddAddress($address);
}
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$mail->AddAttachment("pdf/report.pdf");
$mail->AddAttachment("pdf/template.pdf");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
else {
echo "Message sent!";
}
?>
我的count
变量值从 1 到 n