全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 646|回复: 1

[疑问] Chevereto增加暗抄(BCC)方式保存smtp发送的邮件

[复制链接]
发表于 2020-5-5 14:45:46 | 显示全部楼层 |阅读模式
https://madlax.pw/2020/05/379.html
折腾日记,如果转载注个博客出处就好。



最近把邮件服务器从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"替换成你自己的即可。

  1. $mail->AddBCC("BCC@your.email","your BCC name");
复制代码


2.添加MIAB的邮件过滤器

如果只有一个发件人,则设置“发件人” “包含”,动作为“将邮件移至”“已发送邮件”即可,因为我是2个发件人,所以按以下设置,只要满足一个就生效,anyof意思为“或”,如果是allof则为“和”。
  1. require ["fileinto"];
  2. # rule:[保存发件]
  3. if anyof (address :contains "from" "SENT1@your.email", address :contains "from" "SENT2@your.email")
  4. {
  5. fileinto "Sent";
  6. }
复制代码


发表于 2020-5-5 15:10:05 | 显示全部楼层
天天折腾 真好 我还在为钱发愁
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-27 02:20 , Processed in 0.106035 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表