Skip to content

[Feature Req] Interface that accept To/CC with a single string #152

Closed
@suntong

Description

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 "[email protected],[email protected]", mail: expected single address, got ",[email protected]"

When using

if err := m.To("[email protected],[email protected]"); err != nil {

in https://go-mail.dev/getting-started/introduction/#hl-5-13

Reason being:

  • It is perfectly fine to set the "To:" header to something like "Alice <[email protected]>, Bob <[email protected]>, Eve <[email protected]>" in plain email, so such extra checking is too restrictive.
  • I understand that there might be extra checking on the email address format checking, but since the basic text based unix email doesn't check it, such extra checking can be optional, IMHO. After all, if the user made mistakes in their to/cc email address, they will know eventually.
  • And the most important thing is, to add more recipients, I have to change my Go code to do that, whereas the common sense/practice is to change data, not to change code, when covering different cases.

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

WIPWork is in progressenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions