邮件中含三个附件$mail->AddAttachment($a[0], $a[0]);            // 添加附件,并指定名称
$mail->AddAttachment($a[1], $a[1]);            // 添加附件,并指定名称
$mail->AddAttachment($a[2], $a[2]);            // 添加附件,并指定名称为什么邮件中附件只有一个?   高手请指点

解决方案 »

  1.   

    发送多附件时,查看表单提交数据,$_FILES有几个附件,在发送之前将邮件内容打出来,看内容中有几个附件添加上了。
    我在发邮件时,是将邮件的附件放入一个数组中,然后循环填入邮件正文以下。确认邮件内容无误,再发送。
      

  2.   

    $mail->AddAttachment($a[0], $a[0]); // 添加附件,并指定名称我问的是这么写多个附件!  
      

  3.   


    public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
        try {
          if ( !@is_file($path) ) {//这是惟一的判断
            throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
          }
          $filename = basename($path);
          if ( $name == '' ) {
            $name = $filename;
          }      $this->attachment[] = array(
            0 => $path,
            1 => $filename,
            2 => $name,
            3 => $encoding,
            4 => $type,
            5 => false,  // isStringAttachment
            6 => 'attachment',
            7 => 0
          );    } catch (phpmailerException $e) {
          $this->SetError($e->getMessage());
          if ($this->exceptions) {
            throw $e;
          }
          echo $e->getMessage()."\n";
          if ( $e->getCode() == self::STOP_CRITICAL ) {
            return false;
          }
        }
        return true;
      }
      

  4.   

    发送多个附件是不是多次调用上面的函数?   
    public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream')