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

0

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.

c#
windows-store-apps
asked on Stack Overflow Jan 20, 2014 by user3215105 • edited Jan 20, 2014 by Soner Gönül

1 Answer

0

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 (e.g. 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.

answered on Stack Overflow Jan 20, 2014 by Steffen Ullrich

User contributions licensed under CC BY-SA 3.0