-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Thread safety #42
Comments
You can connect every time in same thread if KeepAlive is false (by default) because the connection closes after email is sent. If you want to use a lot of connections to SMTP server and send in bulk, you can follow #23 to use KeepAlive, and NOOP. |
But what if I want to connect in multiple threads. For example, I need to send a verification email for each connected user (via HTTP) and each HTTP connection is in a separate goroutine. Of course, I can use a channel and connect in a single goroutine... |
Yes, you can connect in multiple threads in that case. It's thread safe if KeepAlive is false. |
Thank you ! |
Hi! Is it thread save to invoke server.Connect on multiple "threads", or I need to create new server each time?
The text was updated successfully, but these errors were encountered: