2011-08-23 38 views

回答

0

您不能使用MessageUI來接收電子郵件。您將不得不創建自己的郵件客戶端。

0

您不能使用MessageUI.framework。

對於之前的項目,我創建了一個簡單的基於PHP的Web服務,託管在我的Web服務器上。 Web服務與POP服務器進行交互。從Web服務中,我可以通過stringWithContentsOfURL將所需信息下載到我的應用程序中。

POP帳戶信息作爲加密參數傳遞給服務。

PHP使得分析電子郵件的有趣部分變得很容易。通過在應用程序外部進行電子郵件處理,可以輕鬆調整電子郵件中數據的衛生狀況。

通知可以在本地處理 - 或者你可以自動運行與服務的PHP像setcronjob.com

在服務器上的腳本看起來有些像這樣:

<?php 

$msgList = array(); 

# Connect to POP server 
if($conn = imap_open("{pop.yourserver.dk:110/pop3}INBOX","[email protected]", "yourpassword")) { 

    # Check for messages 
    $check = imap_mailboxmsginfo($conn); 

    # Process each message 
    for($i = 1; $i <= $check->Nmsgs; $i++) { 
     $message = imap_body($conn,$i); 

     # If the message matches some criteria... 
     preg_match('/([0-9\/]{8}) ([0-9:]{8}).*(Niros)[^\(]*\((.+)\)/m', $message, $matches); 
     if($matches) { 

      # ...save it 
      array_push($msgList, $matches[1]); 

     } 

     # Delete all messages processed and spam 
     imap_delete($connection,$message); 
    } 

    imap_close($conn); 

} 

# Print put the information pulled out of the matched emails 
# JSON formatted data would be easy to parse 
for($i = 0; $i < 10; $i++) { 
    echo array_pop($msgList); 
} 

echo "Last update: ".date(DATE_RFC822); 

?> 
相關問題