首页 文章

使用带有PHP的mailgun从传入的电子邮件中获取附件

提问于
浏览
2

我正在使用mailgun来解析传入的电子邮件 . mailgun将解析后的电子邮件发送到URL(https://example.com/email) .

我能够获取from,to,subject,body等 . 但是我无法获取附件 .

下面是我的代码,它返回一个空值 .

$file = addslashes(file_get_contents($this->input->post('attachment-1'))['name']);

$result = $this->tickets_model->saving_files($file);

请帮帮我 .

谢谢 .

1 回答

  • 1

    我使用它的方法是使用CI上传库首先上传文件,然后解析它 .

    $config['file_name']  = 'filename';
    $config['upload_path'] = '/upload/path';
    $this->load->library('upload', $config);
    if (!$this->upload->do_upload('attachment-1')) {
      // fail
    } else {
      // success
    }
    

相关问题