xheader を含むメールを送信しています。
メールの受信者がそのメールをリプレイしたら、それを解析して、リプレイで取得したメールからその xheader の内容を取得したいと考えています。
残念ながら、戻ってきたメールを解析しているときに、xheader が表示されません。(メール全体を印刷しましたが、xheader はありません)
Zend Framework (私は Zend_Mail_Storage_Imap を使用しています) を使用して PHP でそれを行うにはどうすればよいですか?
コード:
$mail = new Zend_Mail_Storage_Imap(array(
'host' => 'pop.gmail.com',
'user' => 'a@gmail.com',
'password' => 'a',
'ssl' => 'SSL'
));
$count = $mail->countMessages();
$message = $mail->getMessage($count);
print_r($message);
//go through the message
foreach(new RecursiveIteratorIterator($message) as $part){
echo '*****************<br/>';
print_r($part);
echo '<br/>*****************<br/>';
//match parts content type to text/html - the one that maches is the message HTML body
if (preg_match('/.*text\/html.*/', $part->contentType)){
$body = $part->getContent();
}
$headers = $part->getHeaders();
if (isset($headers['X-aHeader'])){
echo $headers['X-aHeader'];
}
ありがとう、ボリス。