Replies: 2 comments 6 replies
-
I think it could be useful to have a ProxyClient.DefaultProxy static property that reads environment variables. I think the nicest approach would be to do: client.Proxy = ProxyClient.DefaultProxy |
Beta Was this translation helpful? Give feedback.
2 replies
-
So I could implement a draft that uses the DefaultProxy of the HTTP Client. @jstedfast what do you think about it? If it is ok, I would finalize it and add some unit tests. Heres the link to the diff https://github.com/jstedfast/MailKit/compare/master...jwonagel:MailKit:features/systemproxy?expand=1 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
All clients (such as SmtpClient, ImapClient, etc.) in MailKit have the option to set a proxy server. The HttpClient and many other libraries use the system default proxy or environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) to configure the proxy.
It would be beneficial if MailKit also supported a default proxy, similar to HttpClient.DefaultProxy (https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.defaultproxy?view=netcore-3.1). In my opinion, the clients could leverage the HttpClient default proxy, which would simplify the implementation. The feature would only be available on .NET Core 3.0 and newer because DefaultProxy was introduced in .NET Core 3.0.
I would implent it like the following SmtpClient example:
I can implement this feature if it's desired and you don't have the time to do it.
Beta Was this translation helpful? Give feedback.
All reactions