【发布时间】:2018-03-10 00:53:06
【问题描述】:
如何发送电子邮件附件中的多个文件。
在视图文件中
<input type="file" name="attachment" id="file_1" />
<input type="file" name="attachmenttwo" id="file_2" />
<input type="file" name="attachmentthree" id="file_3" />
在我的控制器中
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|txt';
$config['max_size'] = '100000';
$config['overwrite'] = TRUE;
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
$this->load->library('email');
$this->load->library('encrypt');
$this->upload->initialize($config);
$this->upload->do_upload('attachment');
$this->upload->do_upload('attachmenttwo');
$this->upload->do_upload('attachmenthree');
$ret = $this->upload->data();
$rettwo = $this->upload->data();
$retthree = $this->upload->data();
$pathToUploadedFile = $ret['full_path'];
$pathToUploadedFiletwo = $rettwo['full_path'];
$pathToUploadedFilethree = $retthree['full_path'];
$this->email->from('abc@gmail');
$this->email->to('bcd@gmail.com');
$this->email->subject('New query');
$this->email->message('hi');
$this->email->attach($pathToUploadedFile);
$this->email->attach($pathToUploadedFiletwo);
$this->email->attach($pathToUploadedFilethree);
$this->email->send();
这是我能够在服务器中成功上传文件但无法在电子邮件中发送附件,我在收件箱中收到了最后一个文件 3 次。
建议我如何发送邮件收件箱中的所有文件
【问题讨论】:
标签: php codeigniter email sendmail