2011-08-23 116 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); 

?> 
相关问题