feat: add alias file support

This commit is contained in:
Aivars Sterns
2025-10-29 11:50:30 +02:00
committed by Bernhard Fröhlich
parent 6e9c00e171
commit 7b6be95125
5 changed files with 88 additions and 4 deletions

11
main.go
View File

@@ -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).