Closed Threnklyn closed 1 year ago
I can implement LOGIN authorization mechanism in /pkg/auth.go
.
Also I suggest adding an auth
field to Sender
struct instead of smtpUserName
and smtpPassword
fields, look at listing below. It will require to rewrite the Sender
constructor and auth check in Send()
method.
@umputun If you do not mind this approach, I will send a PR.
type Sender struct {
smtpClient SMTPClient
logger Logger
host string // SMTP host
port int // SMTP port
contentType string // Content type, optional. Will trigger MIME and Content-Type headers
tls bool // TLS auth
starttls bool // StartTLS
auth smtp.Auth // authentication mechanism
// smtpUserName string // username
// smtpPassword string // password
timeOut time.Duration
contentCharset string
timeNow func() time.Time
}
As long as the current Auth(smtpUserName, smtpPasswd string) Option
is kept untouched and back compatibility is not broken - fine with me.
@umputun please review my PR #15
https://github.com/umputun/remark42/issues/1472
looks like Microsoft does not allow Plain Auth anymore, which is used in go-pkgz/email/email.go. The go
net/smtp
package does not support the login mechanismLOGIN
. Here is an example I found for login auth usingnet/smtp
https://gist.github.com/homme/22b457eb054a07e7b2fb