-
Can I create *mail.Client on top level once and use it in goroutines? Actually we are doing it and getting error:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
In this case it looks like |
Beta Was this translation helpful? Give feedback.
-
Thanks @wneessen for clarification. We are now creating a new client for each request. Not sure if this will have any performance implications. |
Beta Was this translation helpful? Give feedback.
-
Having the same issue after switching from |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I've just pushed #307 into main, which implements goroutine-/thread-safety into go-mail. I would appreciate if some of you could give it a test run and provide any feedback. |
Beta Was this translation helpful? Give feedback.
In this case it looks like
*smtp.Client
is the culprit. It makes use of maps which are not concurrency-safe. Since the*mail.Client
uses the*smtp.Client
it might fail. I've never really used go-mail in goroutines yet, so I would say it's not currency-safe at this point. I'll add an issue though, to look at this at some point.