Committing the additions that add in the Allowed Sender IP functionality.

This commit is contained in:
Omar Ramos
2021-01-05 15:49:46 -08:00
parent eaa5e32600
commit 0c6f4055b7
2 changed files with 51 additions and 0 deletions

View File

@ -27,11 +27,18 @@ func sendMail(e *mail.Envelope, config *relayConfig) error {
msg.WriteString("\r\n")
Logger.Infof("starting email send -- from:%s, starttls:%t", e.MailFrom.String(), config.STARTTLS)
Logger.Infof("Client Remote IP: %s", e.RemoteIP)
var err error
var conn net.Conn
var client *smtp.Client
var writer io.WriteCloser
if AllowedSendersFilter.Blocked(e.RemoteIP) {
Logger.Info("Remote IP of " + e.RemoteIP + " not allowed to send email.")
return errors.Wrap(err, "Remote IP of "+e.RemoteIP+" not allowed to send email.")
}
tlsconfig := &tls.Config{
InsecureSkipVerify: config.SkipVerify, //nolint:gosec
ServerName: config.Server,