go-smtp
go-smtp copied to clipboard
Context support
Adding context support would be nice for tracing and cancellation.
Thanks for this library!
I'd like to see how the API could look like.
For client it would involve duplicating Mail, Rcpt, etc. to add context.Context argument (MailContext, RcptContext).
As for relation to timeouts, perhaps we could have context-less functions create such context with some timeout value (e.g. 5 mins)? That would be convenient for me since maddy interfaces already have context.Context all over the place :)
On a second thought, gluing together net.Conn and context.Context is a tricky task so it is probably better to just implement command timeouts like it is done for the server.
+1 for the context, especially when you need to print debug logs per request and log the request ID. This would also require a rewriting of the Debug functionality.