我試圖在PHP/Zend中創建一個可以從各種不同帳戶(主要是POP和IMAP)收集電子郵件的系統,並將它們全部組合在一個系統中用於分析(內容的電子郵件等)可寫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 :(
}
感謝您可以提供任何見解!
丹