Feature: Add option to disable SMTP reverse DNS (rDNS) lookup (#230)

This commit is contained in:
Ralph Slooten
2024-01-21 09:05:08 +13:00
parent 3f98ac5087
commit 6725db4fa5
4 changed files with 21 additions and 11 deletions

View File

@@ -18,6 +18,11 @@ import (
"github.com/mhale/smtpd"
)
var (
// DisableReverseDNS allows rDNS to be disabled
DisableReverseDNS bool
)
func mailHandler(origin net.Addr, from string, to []string, data []byte) error {
if !config.SMTPStrictRFCHeaders {
// replace all <CR><CR><LF> (\r\r\n) with <CR><LF> (\r\n)
@@ -191,14 +196,15 @@ func Listen() error {
func listenAndServe(addr string, handler smtpd.Handler, authHandler smtpd.AuthHandler) error {
srv := &smtpd.Server{
Addr: addr,
Handler: handler,
HandlerRcpt: handlerRcpt,
Appname: "Mailpit",
Hostname: "",
AuthHandler: nil,
AuthRequired: false,
MaxRecipients: config.SMTPMaxRecipients,
Addr: addr,
Handler: handler,
HandlerRcpt: handlerRcpt,
Appname: "Mailpit",
Hostname: "",
AuthHandler: nil,
AuthRequired: false,
MaxRecipients: config.SMTPMaxRecipients,
DisableReverseDNS: DisableReverseDNS,
}
if config.SMTPAuthAllowInsecure {