2013-10-21 35 views

回答

7

根據開發人員,swiftmailer無法複製到已發送文件夾,因爲它是一個郵件發件人而不是郵箱管理器。

由於在github page提到:

Swiftmailer是發送電子郵件,而不是管理郵箱的庫。所以,這確實超出了Swiftmailer的範圍。

然而,從php.net有人張貼a solution that might work for you

  1. 使用SwiftMailer通過PHP發送消息。

    $message = Swift_Message::newInstance("Subject goes here"); 
    // (then add from, to, body, attachments etc) 
    $result = $mailer->send($message); 
    
  2. 當你構建在步驟1中的消息)以上保存到一個變量,如下所示:

    $msg = $message->toString(); 
    // (this creates the full MIME message required for imap_append()!! 
    // After this you can call imap_append like this: 
    imap_append($imap_conn,$mail_box,$msg."\r\n","\\Seen"); 
    
4

我有類似的問題,Sutandiono的回答讓我到正確的方向。但是由於完整性和我有連接到Exchange 2007服務器的其他問題,我想用來存儲郵件發送文件夾在IMAP提供了一個完整的片段:

$msg = $message->toString(); 
// $message is instance of Swift_Message from SwiftMailer 

$stream = imap_open("{mail.XXXXX.org/imap/ssl/novalidate-cert}", "username", "password", null, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI')); 
// connect to IMAP SSL (port 993) without Kerberos and no certificate validation 

imap_append($stream,"{mail.XXXXX.org/imap/ssl/novalidate-cert}Sent Items",$msg."\r\n","\\Seen"); 
// Saves message to Sent folder and marks it as read 

imap_close($stream); 
// Close connection to the server when you're done 

換成你自己的服務器的主機名,用戶名和密碼信息。

相關問題