Skip to content
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

Improvement: Reuse Connection (or unclear documentation) #56

Open
thedustin opened this issue Feb 27, 2022 · 3 comments
Open

Improvement: Reuse Connection (or unclear documentation) #56

thedustin opened this issue Feb 27, 2022 · 3 comments

Comments

@thedustin
Copy link

Hey, first things first: nice package, thank you for that. But it seems that it is not really possible to keep one connection open?

I want to run this in the background and from time to time send a mail. As far as I understood the documentation (or sadly/more precisely the code 😬) right, it is not intended to reuse a client? Instead I should create a new client for each message (or hope that the connection is still open/use client.noop and maybe re-create the client)? This seems a bit wasteful to open a new connection for every message.

Maybe this could be an improvement for v3? 😁

@xhit
Copy link
Owner

xhit commented Feb 28, 2022

Hi Dusting.

It's possible reuse the connection, but currently is left to the developer to implement the same connection, here a comment explaining how this should be: #23 (comment)

And yes, I want to add this in the package because the implementation require knowledge of how works SMTP protocol, I hope have a time in next days to implement it in v2 because it should not be a breaking change.

@rtanx
Copy link

rtanx commented Aug 4, 2022

is it safe to use single connection in multiple goroutines?

@xhit
Copy link
Owner

xhit commented Aug 4, 2022

@rtanx it's safe always you not send a new operation while another operation is in process, see #23 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants