使用SwiftMailer将邮件添加到发送文件夹 [英] Add mail to Send folder with SwiftMailer
问题描述
我正在从 swiftmailer.org
一切正常,但我想知道是否有一种方法可以将SwiftMailer从其发送的邮件帐户中的已发送邮件添加到已发送文件夹中?
Everything works well but I wonder if there is a way to add the sent message into the sent folder from the mail account that SwiftMailer is sending from?
,祝您有美好的一天。
That's all, have a nice day.
推荐答案
根据开发人员,swiftmailer无法复制到已发送文件夹,因为它是邮件发件人,而不是邮箱管理器。
According to the developer, swiftmailer cannot copy to Sent folder because it is a mail sender and not mailbox manager.
如 github页面所述:
Swiftmailer是一个用于发送电子邮件而不是管理邮箱的库。因此,这确实超出了Swiftmailer的范围。
Swiftmailer is a library to send emails, not to manage mailboxes. So, this is indeed out of the scope of Swiftmailer.
但是,来自php.net的某人发布了可能适合您的解决方案:
However, someone from php.net posted a solution that might work for you:
-
使用SwiftMailer通过PHP发送消息。
Use SwiftMailer to send the message via PHP.
$message = Swift_Message::newInstance("Subject goes here");
// (then add from, to, body, attachments etc)
$result = $mailer->send($message);
在上述步骤1)中构造消息时,将其保存为变量,如下所示:
When you construct the message in step 1) above save it to a variable as follows:
$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");
这篇关于使用SwiftMailer将邮件添加到发送文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!