
我想在開發和階段環境中配置 Postfix 以僅保存像 Papercut 和 Neptune 這樣的電子郵件?
非常重要的是,實際的電子郵件不會被發送,只會被保存,以便能夠在 QA 工作中檢查它們。
答案1
使用正規表示式對應重寫所有收件者。只要您的電子郵件是透過 SMTP 提交的,這就足夠了。
在main.cf中
virtual_alias_maps = regexp:/etc/postfix/recipients
在 /etc/postfix/recipients 中
\#[email protected] is a mailbox where QA will receive email
/.+/ [email protected]
答案2
為什麼要設定一個成熟的郵件伺服器,你可以只使用 python 來做到這一點。
python -m smtpd -n -c DebuggingServer localhost:25 | tee emails.log