【问题标题】:Fetching attachments from incoming emails using mailgun with PHP使用带有 PHP 的 mailgun 从传入的电子邮件中获取附件
【发布时间】:2016-10-28 23:58:24
【问题描述】:

我正在使用 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);

请帮帮我。

谢谢。

【问题讨论】:

    标签: php codeigniter mailgun


    【解决方案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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-13
      • 2022-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-23
      • 2016-11-22
      相关资源
      最近更新 更多