1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-02-11 13:52:52 +02:00

Bugfix: If set use return-path address as SMTP from address

This commit is contained in:
Ralph Slooten 2023-04-21 22:30:02 +12:00
parent 64461c17a1
commit 124f1c2bde

View File

@ -586,13 +586,18 @@ func ReleaseMessage(w http.ResponseWriter, r *http.Request) {
return
}
if config.SMTPRelayConfig.ReturnPath != "" && m.Header.Get("Return-Path") != "<"+config.SMTPRelayConfig.ReturnPath+">" {
msg, err = tools.RemoveMessageHeaders(msg, []string{"Return-Path"})
if err != nil {
httpError(w, err.Error())
return
// set the Return-Path and SMTP mfrom
if config.SMTPRelayConfig.ReturnPath != "" {
if m.Header.Get("Return-Path") != "<"+config.SMTPRelayConfig.ReturnPath+">" {
msg, err = tools.RemoveMessageHeaders(msg, []string{"Return-Path"})
if err != nil {
httpError(w, err.Error())
return
}
msg = append([]byte("Return-Path: <"+config.SMTPRelayConfig.ReturnPath+">\r\n"), msg...)
}
msg = append([]byte("Return-Path: <"+config.SMTPRelayConfig.ReturnPath+">\r\n"), msg...)
from = config.SMTPRelayConfig.ReturnPath
}
// generate unique ID