如何实现将已发送的邮件保存到服务器上

时间: 2021-03-15 / 分类: 邮件服务器 / 浏览次数: 4,151 / 0个评论 发表评论

看到有网友在问这个将客户端发出的邮件保存到服务器上,所以找了一圈,看到下面这篇文章,以下内容转载自https://madlax.pw/2020/05/379.html

Chevereto使用暗抄(BCC)方式保存smtp发送的邮件

最近把邮件服务器从winwebmail换成了Mail-in-a-Box(MIAB),主要是因为winwebmail的window服务器占用资源比较多,而且IIS配置也不方便不熟悉,再一个一直不支持DKIM签名。MIAB确实很方便,有一键包直接完成,要设置的SPF和DKIM也照着他显示的去DNS里设置就好。

但是在Chevereto里调用SMTP发件时发现并没有在发件箱里保存发送的邮件。
查找资料后发现SMTP发送的邮件并没有保存副本到发件箱。

SMTP has no access to your incoming mail; it is simply for outgoing mail. There is no easy way for SMTP to save copies like this.
Yes, Thunderbird can automatically save a copy of all mail it sends, but it uses IMAP to do that.
One thing you could do is to BCC yourself to have a copy of direct-SMTP emails also be sent to you. That would place them in your inbox, but perhaps a filter can move it to Sent for you automatically.
There are also other ways: https://www.chilkatsoft.com/p/p_461.asp
But, as you can see if you look at their code examples, they all send the email via SMTP and then save a copy via IMAP.

于是考虑在发件时添加一份暗抄,然后用过滤器移动至发件箱。已经向Rodolfo提议增加个暗抄选项。

魔改步骤:

1.添加暗抄邮件发送

编辑/app/lib/functions.php在149行后加上以下代码,将"BCC@your.email","your BCC name"替换成你自己的即可。

$mail->AddBCC("BCC@your.email","your BCC name");

2.添加MIAB的邮件过滤器

如果只有一个发件人,则设置“发件人” “包含”,动作为“将邮件移至”“已发送邮件”即可,因为我是2个发件人,所以按以下设置,只要满足一个就生效,anyof意思为“或”,如果是allof则为“和”。

require ["fileinto"];# rule:[保存发件]if anyof (address :contains "from" "SENT1@your.email", address :contains "from" "SENT2@your.email"){fileinto "Sent";}
yldfj.png

参考:
[solved]Feature request:Add an option : Sent BCC email.

Show mails sent with SMTP in SentMail #1370

Server Side Mail Filtering using Sieve

发表评论

您的昵称 *

您的邮箱 *

您的网站