Skip to content

Sending Bulk Email #73

Answered by wneessen
ljfreelancer88 asked this question in Q&A
Oct 25, 2022 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Hi @ljfreelancer88,

that's actually a good point. We currently don't have a proper bulk-mail example. I'll add one to the documentation in the next days. For now, a few changes I would suggest for your code:

  • Instead of using m.To("v.Name <v.Email>"); you can use m.AddToFormat(v.Name, v.Email)which will take care of the proper formating for you.
  • In your example you create a new client in the for loop. This is not needed. go-mail can reuse the client connection and takes a list of *mail.Msg in the c.DialAndSend() call. Therefore I suggest to create an empty mail message slice []*mail.Msg and only append the prepared mails into that in the for loop and eventually provide the message slice t…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@ljfreelancer88
Comment options

@wneessen
Comment options

@wneessen
Comment options

@ljfreelancer88
Comment options

@wneessen
Comment options

Answer selected by wneessen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants