2016-09-30 76 views
1

我想處理json(通過收到的電子郵件的mailgun的郵寄請求收到)。在郵件槍中處理傳入電子郵件的問題

我正在使用codeigniter。

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

}, 
"log-level": "info", 
"timestamp": 1475215276.814206, 
"message": { 
"headers": { 
    "to": "[email protected]", 
    "message-id": "[email protected]om", 
    "from": "User Test <[email protected]>", 
    "subject": "example email for testing" 
}, 
"attachments": [], 
"recipients": [ 
    "[email protected]" 
], 

我沒有訪問$this->input->post('from')主題價值$this->input->post('subject')任何問題。

但是我試圖訪問收件人用下面的代碼,但所有我得到的是空值。

$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); 

任何幫助將是偉大的。

回答

0

以下列方式得到地址。

在笨:

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

在PHP:

$_POST['recipient'];