Open vladoohr opened 6 years ago
use go 1.9 or support ssl mail server
See #108
TL;DR: try setting your username (third argument ingomail.NewDialer
) to an empty string
This seems to be a built in yet undocumented workaround that allows you to bypass these two if
blocks from Dial()
in gomail/smtp.go
:
if d.Auth == nil && d.Username != "" {
if ok, auths := c.Extension("AUTH"); ok {
if strings.Contains(auths, "CRAM-MD5") {
d.Auth = smtp.CRAMMD5Auth(d.Username, d.Password)
} else if strings.Contains(auths, "LOGIN") &&
!strings.Contains(auths, "PLAIN") {
d.Auth = &loginAuth{
username: d.Username,
password: d.Password,
host: d.Host,
}
} else {
d.Auth = smtp.PlainAuth("", d.Username, d.Password, d.Host)
}
}
}
if d.Auth != nil {
if err = c.Auth(d.Auth); err != nil {
c.Close()
return nil, err
}
}
Did you finally solve it and how to do it?
@wickerplane but get another error : client is not auth to send anoymous mail FROM, have any idea ?
see #182 ;-((
Hello,
I am getting the followinfg error: unencrypted connection. I am using MailHog as SMTP server.
Here is the code snipped:
func Send(mailInfo Info, cfg config.Config, template string) error { d := gomail.NewDialer(cfg.Mail["host"], port, cfg.Mail["user"], cfg.Mail["password"])
}
How I can use unencrypted connection with this library?
Thanks in advance.