mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 07:43:06 -07:00
Support LOGIN authentication on outgoing SMTP server
PR: #1 Obtained from: https://gist.github.com/andelf/5118732
This commit is contained in:
9
main.go
9
main.go
@@ -110,7 +110,14 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
|
||||
host, _, _ := net.SplitHostPort(*remoteHost)
|
||||
|
||||
if *remoteUser != "" && *remotePass != "" {
|
||||
auth = smtp.PlainAuth("", *remoteUser, *remotePass, host)
|
||||
switch *remoteAuth {
|
||||
case "plain":
|
||||
auth = smtp.PlainAuth("", *remoteUser, *remotePass, host)
|
||||
case "login":
|
||||
auth = LoginAuth(*remoteUser, *remotePass)
|
||||
default:
|
||||
return smtpd.Error{Code: 530, Message: "Authentication method not supported"}
|
||||
}
|
||||
}
|
||||
|
||||
env.AddReceivedLine(peer)
|
||||
|
||||
Reference in New Issue
Block a user