go-simple-mail icon indicating copy to clipboard operation
go-simple-mail copied to clipboard

Use mail.Address instead of plain strings

Open ivanjaros opened this issue 4 years ago • 4 comments

With simple plain strings we are unable to set the name, only the address of the recipient(s). Use mail.Address.String() for headers, where full format works, and use mail.Address.Address for smtp's mail and rcpt methods to make it work with the smtp protocol.

ivanjaros avatar Nov 14 '20 20:11 ivanjaros

If I can understand, do you want set the name of recipient?

xhit avatar Nov 16 '20 13:11 xhit

yes: Mr. Foo Bar <[email protected]>

Just keep in mind what I wrote above - you can use this format only in headers not in the smtp's methods which expect just plain email address.

ivanjaros avatar Nov 16 '20 14:11 ivanjaros

I got it. I prefer use the plain string because I don't want to do a breaking change now. I will think how to maintain both ways instead dropping the current.

xhit avatar Nov 16 '20 14:11 xhit

It's time to V3 so make all your ideas here: #53

xhit avatar Nov 18 '21 03:11 xhit