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

Implement reconnect or reconnect helper from #23 #73

Open
flowchartsman opened this issue Dec 11, 2022 · 1 comment
Open

Implement reconnect or reconnect helper from #23 #73

flowchartsman opened this issue Dec 11, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@flowchartsman
Copy link

I ended up spending several hours trying to make a type that would wrap the SMTPClient type and do the NOOP sending to implement the suggestion in this comment before I realized there was no easy way to track the last time an email was sent for the timer, and you cannot do that by wrapping a SMTPClient because the email type is what sends the email in Email.Send, by calling an an unexported internal function. This means that I need to create a special EmailProvider which returns a new type embedding Email so that I can wrap Email.Send and Email.SendEnvelopeFrom to track the SMTPClient with a mutex and reset the loop. Also SMTPClient has an exported Client field, which returns the unexported internal smtpClient type, which is unfortunately useless. So I cannot have the SMTPServer reconnect the internal smtpClient, and I must use EmailProvider to do that. It's a bit convoluted and not nearly as easy as the solution in #23 would suggest.

It would be nice if there was a way to do this in the library, or if you could provide a type like my EmailProvider that wraps the client and server objects to re-create it when necessary.

@xhit
Copy link
Owner

xhit commented Dec 12, 2022

Yes, need to be done in the package, I can restore an early implementation from older laptop that currently works in production.

Currently I'm too busy, I hope have time in January 2023.

I remember the solution was very simple in the package. Doesn't need any change or new type, current code will be working and developer can send emails in same connection in bulk without need to make a NOOP or reconnect, only using the same connection.

@xhit xhit added the enhancement New feature or request label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants