phpmailer不发送多个附件

时间:2012-04-01 15:38:43

标签: php upload phpmailer

我正在使用代码发送多个附件,它使用电子邮件成功发送了多个附件,但现在它停止使用相同的代码。我不知道错误,因为没有显示错误,邮件被发送,但没有附件。 代码是:

  Else
  {
$numFiles = count(array_filter($_FILES['uploaded']['name']));
for ($i = 0; $i < $numFiles; ++$i) 
{
$target_path = "Email/";
$target_path = $target_path . basename($_FILES['uploaded']['name'][$i]);
if(move_uploaded_file($_FILES['uploaded']['tmp_name'][$i], $target_path)) {
echo "the file ".basename($_FILES['uploaded']['name'][$i])." has been uploaded<br />";
}
$mail->AddAttachment($target_path);
 } 
$mail->From     = $From;
$mail->FromName = $FromName;

$mail->AddAddress($To , $ToName);

$mail->WordWrap = 50;               // set word wrap
$mail->Priority = 1; 
$mail->IsHTML(true);  
$mail->Subject  =  $Subject;
$mail->Body     =  $Body;

if(!$mail->Send())
{   echo "Mailer Error: " . $mail->ErrorInfo;}

0 个答案:

没有答案