Skip to content

Implement reconnect or reconnect helper from #23 #73

@flowchartsman

Description

@flowchartsman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions