邮件无法从Gmail中检索 [英] Mails not retrieving from Gmail
问题描述
我正在使用这个Limilabs Mail.dll并在第一次通过此代码删除从中检索到的邮件后现在我没有收到邮件。
以下是代码:
I was using this Limilabs Mail.dll and after deleting the mails retrieved from it first time through this code Now I am receiving no mails.
Below is the code:
string conn = @"Data source=(local);Initial Catalog=fyp;Integrated Security=true";
SqlConnection con = new SqlConnection(conn);
string add, name;
byte[] buffer;
using (Pop3 pop3 = new Pop3())
{
pop3.Connect("pop.gmail.com", 995, true); // or ConnectSSL for SSL
pop3.Login("username", "password");
// Receive all messages and display the subject
MailBuilder builder = new MailBuilder();
foreach (string uid in pop3.GetAll())
{
IMail email = builder.CreateFromEml(
pop3.GetMessageByUID(uid));
foreach (MailBox m in email.From)
{
add = m.Address;
name = m.Name;
string date = (email.Date).ToString();
string sub = (email.Subject);
string text = (email.Text);
foreach (MimeData mime in email.Attachments)
{
mime.Save(@"d:\" + mime.SafeFileName);
buffer = mime.Data;
string qry = "insert into retmail_2 values (@sub,@text,@date)";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.Parameters.AddWithValue("@sub", sub);
cmd.Parameters.AddWithValue("@text", text);
cmd.Parameters.AddWithValue("@from", add);
cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.AddWithValue("@date", date);
cmd.Parameters.AddWithValue("@attch", buffer);
con.Open();
int g = cmd.ExecuteNonQuery();
con.Close();
}
pop3.Close();
}
}
现在它没有检索邮件所以你们可以告诉我除此之外的一些永久性解决方案,因为它是现在不检索邮件.Thing是检索到的所有邮件,它们存储在windows窗体中给出的datagridview中。现在,在行单元格点击事件中它显示邮件,当它检索邮件时,它将它们插入到sqlserver 2008中的表中,其中有一个自动生成的整数类型uid。现在正在调试它在gridview中显示uid -1并且在数据库中没有检索到任何东西。
我认为邮件没有从邮件服务器中检索。这就是为什么会发生这种情况。我不知道从服务器检索邮件的其他方式。
帮我PLZ。
Now it is retrieving no mails so guys can you tell me some permanent solution other than this because it is retrieving no mails now.Thing is all the mails that r retrieved they are stored in a datagridview given in the windows form. Now on row cell click event it was shows mails also when it retrieves mails it inserts them into a table made in sqlserver 2008 its in which there is an autogenerated integer type uid. Now on debugging it is showing uid -1 in gridview and nothing is retrieved in the database.
i thought that the mails are not retrieving from the mail server.Thats why this is happening. I dont know other way to retrieve mails from a server.
Help me PLZ.
推荐答案
这篇关于邮件无法从Gmail中检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!