さまざまなアカウント(主にPOPとIMAP)からメールを収集し、分析(メールの内容など)のためにそれらをすべて1つのシステムにまとめることができるシステムをPHP/Zendで作成しようとしています。
私が設計しているシステムでは、ユーザーがメールを表示する必要がある場合に元の形式でメールを表示するように求められるため、アカウントからメールを読み取ってローカルに移動する予定です。Zend_Mail_Storage_Writable_Maildirを使用してローカルのMaildir構造を作成し、各アカウントから戻ってきたメッセージを追加しています。
さまざまなアカウントに接続してメールを取得し、問題なくローカルのMaildirアカウントに追加することができます。私の問題は、Maildirアカウントに追加された各メッセージを区切る一意の識別子が見つからないように見えることです(各電子メールの電子メール情報の一部を一意の識別子とともにデータベースに保存する予定です)。
Zend_Mail_Storage_Writable_Maildirインスタンスに最近追加されたメッセージの一意の識別子を取得する方法を知っている人はいますか?
私の基本的なコードは次のとおりです。
// Set config array for connecting to an email account (Hotmail, gMail etc.)
$config = array(
'host'=> 'xxxx',
'user' => 'xxxx',
'password' => 'xxxx',
'ssl' => 'SSL',
'port' => 995);
// Connect to the account and get the messages
$mail = new Zend_Mail_Storage_Pop3($config);
// Connect to the local Mairdir instance so we can add new messages
$mailWrite = new Zend_Mail_Storage_Writable_Maildir(array('dirname' => '/xxxx/xxxx/'));
// Loop through the messages and add them
foreach ($mail as $messageId => $message)
{
// ADDING THE MESSAGE WORKS FINE, BUT HOW DO I GET THE UNIQUE
// IDENTIFIER FOR THE MESSAGE I JUST ADDED?
$mailWrite->appendMessage($message);
// FYI: $messageId seems to be the message ID from the originating account; it
// starts at one and increments, so this can't be used :(
}
あなたが提供できるかもしれない洞察に感謝します!
ダン