forked from drew/smtprelay
feat: add alias file support
This commit is contained in:
committed by
Bernhard Fröhlich
parent
6e9c00e171
commit
7b6be95125
11
main.go
11
main.go
@@ -159,6 +159,17 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
|
||||
peerIP = addr.IP.String()
|
||||
}
|
||||
|
||||
// Check for aliases
|
||||
for i, recipient := range env.Recipients {
|
||||
if alias, exists := aliasesList[recipient]; exists {
|
||||
env.Recipients[i] = alias
|
||||
log.Info().
|
||||
Str("original_recipient", recipient).
|
||||
Str("aliased_recipient", alias).
|
||||
Msg("Recipient address aliased")
|
||||
}
|
||||
}
|
||||
|
||||
logger := log.With().
|
||||
Str("from", env.Sender).
|
||||
Strs("to", env.Recipients).
|
||||
|
||||
Reference in New Issue
Block a user