-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Req] Interface that accept To/CC with a single string #152
Comments
Hi @suntong, thanks for the feature request. I see your need here and I think it might be a good addition to go-mail. To not break any current code, I suggest something like |
Thanks for the confirmation. I'll make a try... |
This could be handled locally fairly easily too: if err := m.To(strings.Split("a1@gmail.com,a2@gmail.com", ",")...); err != nil { |
indeed! |
Thanks for the PR @suntong, but I feel that adding complexity func (m *Msg) ToFromSimpleString(v string) error {
return m.To(strings.Split(v)...);
} or something similar. This let's us stay true with the KISS principle. |
Yeah, agree. |
That'd be great, if possible. Reopen it again, and feel free to close it anytime. |
Added new methods `ToFromString()`, `CcFromString()` and `BccFromString()` in msg.go file to handle strings of comma-separated email addresses.
Is your feature request related to a problem? Please describe.
Please consider adding/allowing passing a single string to To/CC. Currently there is an extra check preventing it:
failed to set To address: failed to parse mail address "a1@gmail.com,a2@gmail.com", mail: expected single address, got ",a2@gmail.com"
When using
if err := m.To("a1@gmail.com,a2@gmail.com"); err != nil {
in https://go-mail.dev/getting-started/introduction/#hl-5-13
Reason being:
To:
" header to something like"Alice <alice@example.com>, Bob <bob@example.com>, Eve <eve@example.com>"
in plain email, so such extra checking is too restrictive.Describe the solution you'd like
Adding/allowing passing a single string to To/CC.
I can work on PR for that.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: