我现在做的是邮件接收的功能
有一张userX表 存储的是用户信息
一张messageX表 存储的是邮件信息代码:
private void getEmailService()
{
while (bFlag)
{
连接数据库查询ueserX表的信息返回给你dataset for(int i =0; i<dataset.table[0]rows.count; i++)
{
try
{
oPopMail = new POP3Class();
Message mailMessage;
Attachments atts;
jmail.Attachment att;
oPopMail.Connect(userX表中用户邮箱账号, userX表中用户邮箱密码, Pop, Convert.ToInt32("110")); if (0 < oPopMail.Count)//获取制定用户邮箱中邮件的个数
{
执行接收邮件信息操作并保存到messageX表中
//测试后 代码没问题 所以省略掉了
}
oPopMail.Disconnect(); //断开
oPopMail = null;
}
catch
{
oPopMail.Disconnect(); //断开
oPopMail = null;
}
Thread.Sleep(1000);
}
}
}
如果数据库查询userX中获取的第一条记录中 存储的邮箱 账号 密码 pop数据不存在 有时会报Connection reset by client.错误 有时报Connection time out
如果报Connection reset by client.错误 后面查询userX表中正确的邮箱信息也连接不上导致报Connection reset by client.的错误
反而错误信息报报Connection time out的时候 后面正确的邮箱信息便可正常接收
省去的代码没有问题
是不是oPopMail 连接问题或释放问题 求指教!
有一张userX表 存储的是用户信息
一张messageX表 存储的是邮件信息代码:
private void getEmailService()
{
while (bFlag)
{
连接数据库查询ueserX表的信息返回给你dataset for(int i =0; i<dataset.table[0]rows.count; i++)
{
try
{
oPopMail = new POP3Class();
Message mailMessage;
Attachments atts;
jmail.Attachment att;
oPopMail.Connect(userX表中用户邮箱账号, userX表中用户邮箱密码, Pop, Convert.ToInt32("110")); if (0 < oPopMail.Count)//获取制定用户邮箱中邮件的个数
{
执行接收邮件信息操作并保存到messageX表中
//测试后 代码没问题 所以省略掉了
}
oPopMail.Disconnect(); //断开
oPopMail = null;
}
catch
{
oPopMail.Disconnect(); //断开
oPopMail = null;
}
Thread.Sleep(1000);
}
}
}
如果数据库查询userX中获取的第一条记录中 存储的邮箱 账号 密码 pop数据不存在 有时会报Connection reset by client.错误 有时报Connection time out
如果报Connection reset by client.错误 后面查询userX表中正确的邮箱信息也连接不上导致报Connection reset by client.的错误
反而错误信息报报Connection time out的时候 后面正确的邮箱信息便可正常接收
省去的代码没有问题
是不是oPopMail 连接问题或释放问题 求指教!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货