Good day, I use the mimekit library to work with IMAP. But having turned over the entire Internet, I really did not find anything. Shoveled a bunch of other IMAP libraries, then the search for letters works through the back seat, then there is no documentation on how to use a proxy, and in general, can they use a proxy? Such a question, can anyone know what kind of library, or how you can use a proxy in this library, or in ImapX - There is the same problem with a proxy.
|
1 answer
The mimekit library is just a parser. You must first prepare (create, download) MIME content on which you set the library on.
Presumably you have a bunch of MailKit + Mimekit. One of the parameters of the connect () method, the MailKit library, is socket. Accordingly, you need to independently implement the proxy functionality and pass your socket to the connent method. In order not to flip through the specification, I suggest using the ready-made solution ProxySocket .
string server = "imap.yandex.ru"; int port = 993; string proxyIP = "0.0.0.0"; int proxyPort = 1080; client = new ImapClient() // imap клиент ... ProxySocket socket = new ProxySocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.ProxyEndPoint = new IPEndPoint(IPAddress.Parse(proxyIP ), proxyPort); socket.ProxyType = ProxyTypes.Socks4; socket.Connect(server, port); if (socket.Connected) { client.Connect(socket, server, port); } ... |