go-gomail / gomail

The best way to send emails in Go.
MIT License
4.4k stars 580 forks source link

Сould not send email if it have dot before @ in address #199

Open kko123 opened 5 months ago

kko123 commented 5 months ago

If you will try to send mail to any address like bla-bla-ala.@domain.tld, you will get error: gomail: could not send email 1: gomail: invalid address "bla-bla-ala.@domain.tld": mail: missing '@' or angle-addr But address is fully working and receive email from another clients.

wneessen commented 4 months ago

Even though you mail server might accept this mail address, according to RFC 5322 this address is not valid.

RFC 5322 Section 3.4.1: "Addr-spec specification" provides the complete syntax of an email address (addr-spec).

addr-spec       = local-part "@" domain
local-part      = dot-atom / quoted-string / obs-local-part
dot-atom        = [CFWS] dot-atom-text [CFWS]
dot-atom-text   = atom *("." atom)
atom            = [A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+

dot-atom-text specifies that the local-part cannot have leading or trailing dots, nor can it have consecutive dots.

Btw. this packages is also not actively maintained anymore. It hasn't seen an update in the last 6 years. You might wanna consider switching to wneessen/go-mail - this package won't accept that mail address neither, as both packages make use of Go's Stdlib net/mail address parser which follows RFC 5322.