【问题标题】:Issue processing incoming emails in mailgun在 mailgun 中处理传入电子邮件的问题
【发布时间】:2016-10-05 02:07:37
【问题描述】:

我想处理 json(通过来自 mailgun 的传入电子邮件的 post 请求接收)。

我正在使用 codeigniter。

以下是我正在处理的 json 的一部分。

 },
"log-level": "info",
"timestamp": 1475215276.814206,
"message": {
"headers": {
  "to": "helpdesk@example.com",
  "message-id": "CALv887xt-=_ijgb1iC0BQcOwJXguOWbiF7j+Licx6kqperh5Zg@mail.gmail.com",
  "from": "User Test <user.test@gmail.com>",
  "subject": "example email for testing"
},
"attachments": [],
"recipients": [
  "53954680dacd5416eedb3f8639ece5f9@email.example.com"
],

访问 from$this-&gt;input-&gt;post('from')subject$this-&gt;input-&gt;post('subject') 没有任何问题。

但是,我尝试使用以下代码访问 torecipients,但我得到的只是空值。

$to = $this->input->post('to');

$message_header = $this->input->post('message');
$recipients = $message_header->recipients;
$email = $recipients[0];
$email_q = filter_var($email, FILTER_SANITIZE_EMAIL);

任何帮助都会很棒。

【问题讨论】:

    标签: php codeigniter mailgun


    【解决方案1】:

    通过以下方式获得收件人地址。

    在 Codeigniter 中:

    $this->input->post('recipient');
    

    在 PHP 中:

    $_POST['recipient'];
    

    【讨论】:

      猜你喜欢
      • 2016-11-22
      • 2016-12-07
      • 2010-10-01
      • 1970-01-01
      • 2019-07-18
      • 1970-01-01
      • 2011-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多