2
0
forked from drew/smtprelay

Allow remote authentication to be optional

This commit is contained in:
Bernhard Froehlich
2018-12-12 08:38:13 +00:00
parent ba30ddd83c
commit a70b148821

View File

@@ -27,11 +27,16 @@ var (
func handler(peer smtpd.Peer, env smtpd.Envelope) error {
var auth smtp.Auth
host, _, _ := net.SplitHostPort(*remoteHost)
if *remoteUser != "" && *remotePass != "" {
auth = smtp.PlainAuth("", *remoteUser, *remotePass, host)
}
return smtp.SendMail(
*remoteHost,
smtp.PlainAuth("", *remoteUser, *remotePass, host),
auth,
env.Sender,
env.Recipients,
env.Data,