简体   繁体   中英

Unable to connect IMAP server using StreamSocket when we are behind the Proxy

I'm writing a simple C# Store app to check email messages for IMAP. I'm using StreamSocket to connect IMAP server. But the problem is, when we are behind the proxy we are unable to connect to IMAP server and getting below error message.

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C)".

I have added the code snippet for the reference.

StreamSocket Socket = new StreamSocket();   
await Socket.ConnectAsync(new HostName("imap.gmail.com"), "993", SocketProtectionLevel.SslAllowNullEncryption);

But the same code is working fine when there is no proxy.

Could you please help regarding this problem?

My Development Environment is C# using VS2013 with Windows 8.1 Operating System.

Thanks in advance.

The proxy you refer to is probably a web proxy only and all access to the outside is only allowed through this proxy. This means, that only web traffic (eg http, https and proxied ftp) can pass, but not other procols like IMAP, SMTP (mail sending) etc - because these cannot be tunneled through a HTTP proxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM