High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Remove redundant SMTP LOGIN auth implementation
Kailash Nadhabddcb9a03f0
diff --git a/internal/messenger/emailer.go b/internal/messenger/emailer.goindex 2e9f718f..657a0e6c 100644--- a/internal/messenger/emailer.go+++ b/internal/messenger/emailer.go@@ -1,7 +1,6 @@package messengerimport (- "errors""fmt""math/rand""net/smtp"@@ -12,12 +11,6 @@ import (const emName = "email"-// loginAuth is used for enabling SMTP "LOGIN" auth.-type loginAuth struct {- username string- password string-}-// Server represents an SMTP server's credentials.type Server struct {Name string@@ -56,7 +49,7 @@ func NewEmailer(srv ...Server) (*Emailer, error) {case "plain":auth = smtp.PlainAuth("", s.Username, s.Password, s.Host)case "login":- auth = &loginAuth{username: s.Username, password: s.Password}+ auth = &smtppool.LoginAuth{Username: s.Username, Password: s.Password}case "":default:return nil, fmt.Errorf("unknown SMTP auth type '%s'", s.AuthProtocol)@@ -139,23 +132,3 @@ func (e *Emailer) Push(fromAddr string, toAddr []string, subject string, m []bytfunc (e *Emailer) Flush() error {return nil}--// https://gist.github.com/andelf/5118732-// Adds support for SMTP LOGIN auth.-func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {- return "LOGIN", []byte{}, nil-}--func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {- if more {- switch string(fromServer) {- case "Username:":- return []byte(a.username), nil- case "Password:":- return []byte(a.password), nil- default:- return nil, errors.New("unkown SMTP fromServer")- }- }- return nil, nil-}