多图像附件在codeigniter中产生错误

时间:2019-05-03 15:41:26

标签: codeigniter email

我正在尝试在电子邮件中附加多个图像,并且这些附件已正确发送,但出现错误消息:

无法找到以下电子邮件附件: 无法找到以下电子邮件附件: 220 smtp.googlemail.com ESMTP j12sm3168737pff.148-gsmtp

//将文件保存在数据库表中                       如果($ _FILES ['files'] ['name']){

                      $DbArray = getDbArray("maintenanceimages");
                      $DBdata = $DbArray['dbdata'];

                      $filesCount = count($_FILES['files']['name']);

                      for($i = 0; $i < $filesCount; $i++) {

                          $_FILES['file']['name']     = $_FILES['files']['name'][$i];
                          $_FILES['file']['type']     = $_FILES['files']['type'][$i];
                          $_FILES['file']['tmp_name'] = $_FILES['files']['tmp_name'][$i];
                          $_FILES['file']['error']     = $_FILES['files']['error'][$i];
                          $_FILES['file']['size']     = $_FILES['files']['size'][$i];

                          // File upload configuration
                          $uploadPath = ASSETS_DIR . 'admin/img/maintenance/';
                          $config['upload_path'] = $uploadPath;
                          $config['allowed_types'] = 'jpg|jpeg|png|gif';

                          // Load and initialize upload library
                          $this->load->library('upload', $config);
                          $this->upload->initialize($config);

                          // Upload file to server
                          if($this->upload->do_upload('file')) {
                              // Uploaded file data
                              $Images[] = $this->upload->data();

                              $DBdata['ImageName'] = $_FILES['file']['name'];
                              $DBdata['ImagePath'] = $config['upload_path'];
                              $DBdata['ImageSize'] = $_FILES['file']['size'];
                              $DBdata['MaintenanceId'] = $id;
                              $Images[] = $_FILES['file'];
                              save("maintenanceimages", $DBdata);

                          }

                      }
                  }







                //send email
                  $config = Array(
                      'protocol' => 'smtp',
                      'smtp_host' => 'ssl://smtp.googlemail.com',
                      'smtp_port' => 465,
                      'smtp_user' => 'abc@gmail.com',
                      'smtp_pass' => 'abc'
                  );

                  $this->load->library('email',$config);
                  $this->email->set_newline("\r\n");

                  // attachment
                  foreach($Images as $image)
                  {
                      $this->email->attach($image['full_path']);
                  }

                  $this->email->from("abc@gmail.com");
                  $this->email->to("abc@gmail.com");
                  $this->email->subject("Maintenance complain");
                  $this->email->message($this->input->post('FullName') ." has submitted a Maintenance complain");


                  if($this->email->send())
                  {
                      echo "Your email was sent.!";
                  } else {
                      show_error($this->email->print_debugger());
                  }

0 个答案:

没有答案