ga('set', 'anonymizeIp', 1);
Categories: 运维

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/s.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";
}

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

Show mails sent with SMTP in SentMail #1370

Server Side Mail Filtering using Sieve

madlaxcb

Recent Posts

Chevereto 4.2.4 改造,禁用API

4.2版新增了TAG功能,现在…

2周 ago

Windows 11 远程桌面“凭据不工作”的解决方法

依旧是脑残微软的设计风格,远程…

4周 ago

PVE7/PVE8 LXC容器开启TUN/TAP

今天打算用IPV6的LXC开启…

5月 ago

解决WIN10显示器重启后分辨率变低窗口乱跳问题

  最近换了显示器,当有事离开…

9月 ago

宝塔开启堡塔防入侵会导致Chevereto的Cron运行失败

昨晚给服务器搬迁,新服务器装了…

1年 ago