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

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

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

2月 ago

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

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

7月 ago

chevereto V3和V4的改造

今天有空升级了cheveret…

11月 ago

宝塔计划任务里的定时谷歌云盘备份修改为多线程压缩(20230930)

多核机器看着在那单线程压缩几十…

12月 ago

win11开启bbr2

powershell: net…

1年 ago

OVH使用API安装发行版内核的系统(关于API,IPXE,RAID等)

OVH的新面板提供的系统模板比…

1年 ago