大网数据广告活动
服务器运维问答

Email proxy architecture

· 52CE 我爱测

I'm trying to figure out how email proxies generally work. I want to present the way I see the architecture, would be glad if anyone could explain which of my assumptions is flawed and what am I missing. Assume I've purchased an …

问题原文

原帖链接 · Evgeny · CC BY-SA 4.0

I'm trying to figure out how email proxies generally work. I want to present the way I see the architecture, would be glad if anyone could explain which of my assumptions is flawed and what am I missing.

Assume I've purchased an email domain, let's say example.com, now I want to proxy all emails arriving to my domain, do some computation on them and then either drop the email or forward it to the destination based on the computation result.

  1. I will change MX record for example.com to arrive to my email proxy server that will be available via some public ip or domain
  2. Now all emails arrive to my proxy server, i can then write some custom code, analyze the email and either drop it or decide to forward
  3. Now comes the unclear part for me, how do I forward the email? Do i just resend it with the same sender and recipients? Then obviously I won't be able to pass authentication on the destination server as I'm not allowed to send emails from every possible domain.

My understanding is that I should somehow whitelist my proxy by IP or domain on the email destination? To basically allow emails arriving from my proxy to bypass authentication?

So that's what I tried to do:

  • When sending email I need to specify SMTP server and port, if I'm forwarding email, should this be a sender SMTP server or recipient SMTP server? If yes how can I skip sender authentication on the destination?

  • As a small POC I tried to just send unauthenticated email from my personal gmail to my personal outlook, so I've sent an email via smtp.office365.com:587 and I've whitelisted IP of the machine I've sent an email from on Outlook side but it didn't work. I was failing with:

could not send email 1: 530 5.7.57 Client not authenticated to send mail. [VI1P194CA0052.EURP194.PROD.OUTLOOK.COM]"

Any help is appreciated. Also if anyone familiar with some existing solutions that allow injecting custom code for handling will be happy to know.

已采纳解答

原帖链接 · AnFi onet.eu · CC BY-SA 4.0

Server side incoming mail anti-spam filtering [milter]

Standard recommendation for incoming mail anti-spam filtering requires in SMTP sessions filtering. Messages "classified as spam" are rejected in reply to "the final dot" (end of message transmission) or even earlier. It makes sender aware in case of false positive but it avoids taking over responsibility for sending bounce message (notification via email).

You may use milter extensions to get such functionality. Milters are supported by Sendmail, Postfix and other SMTP servers.

You can use MIMEDefang milter to get "a working prototype" fast. MIMEDefang uses Perl script for filtering so you may (initially) simply call your program from the Perl script. MIMEDefang is available as Debian-Linux package (it usually means availability on many Linux distributions).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-01-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。