在 mailgun 中处理传入电子邮件的问题

Issue processing incoming emails in mailgun

我想处理 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"
],

从 值 $this->input->post('from')subject$this->input->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);

任何帮助都会很棒。

通过以下方式获取到地址

在 Codeigniter 中:

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

在PHP中:

$_POST['recipient'];