连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应。 [英] 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.
本文介绍了连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using (var imapClient = new ImapClient(host, userName, passWord, ImapClient.AuthMethods.Login, 993, true))
{
if (type == "inbox")
{
imapClient.SelectMailbox("INBOX");
}
else if (type == "draft")
{
imapClient.SelectMailbox("[Gmail]/Drafts");
}
else if (type == "sent")
{
imapClient.SelectMailbox("[Gmail]/Sent Mail");
}
else if (type == "spam")
{
imapClient.SelectMailbox("[Gmail]/Spam");
}
else if (type == "trash")
{
imapClient.SelectMailbox("[Gmail]/Trash");
}
messages = new List<MailMessage>(imapClient.GetMessageCount());
int Msgcount = imapClient.GetMessageCount();
AllMsgCount = Msgcount;
if (Msgcount < NoRows)
{
messages = imapClient.GetMessages(0, Msgcount, false, seenUnseen).ToList();
}
else
{
if (lastMsgCount == 0)
{
lastMsgCount = 20;
}
lastMsgCount = Msgcount - lastMsgCount;
if (Msgcount >= 0)
{
if (tmpnorows > 0)
{
messages = imapClient.GetMessages(Msgcount, Msgcount + tmpnorows, false, seenUnseen).ToList();
}
else
{
messages = imapClient.GetMessages(Msgcount, Msgcount - 10, false, seenUnseen).ToList(); ;
}
//messages = imapClient.GetMessages(Msgcount, Msgcount - 20, false, seenUnseen)..Where(m => !m.Flags.HasFlag(Flags.Seen) && !m.Flags.HasFlag(Flags.Deleted)).ToList();
}
}
推荐答案
你正在使用gmail - 所以你应该试试
you're using gmail - so you should try
telnet <your imap host address> 993
看看你是否收到回复,并从那里开始追踪网络路径,看看你是否有外部连接/防火墙问题
to see if you get a response, and start tracing the network path from there to see if you have external connectivity/firewall issues
确定没问题,由于某些服务器托管问题,我的代码工作正常,除了gmail中的一些更改外,我得到了那种类型的错误。
ok fine thats code working fine due to some server hosting problam i got that type of error excepting some changes in gmail .
这篇关于连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文