使用EAGetMail阅读新邮件和删除邮件 [英] reading new mail and deleting mail using EAGetMail

查看:77
本文介绍了使用EAGetMail阅读新邮件和删除邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用EAGetMail阅读新邮件和删除邮件。请给我一些解决方案。我可以成功获取所有邮件,但我不想要所有邮件我只想要新的未读邮件。我也要删除我的Gmail邮箱中的邮件或者将邮件从收件箱移到垃圾箱

代码: -

 oClient =  new  MailClient(  TryIt); 
oServer.SSLConnection = true ;
oServer.Port = 993 ;
oServer.User = rms@convate.com;

oClient.GetMailInfosOption = GetMailInfosOptionType.NewOnly;
oClient.Connect(oServer);

if (oClient.Connected)
{
MessageBox.Show( 服务器已连接);
}

MailInfo [] infos = oClient.GetMailInfos();
MessageBox.Show(infos.Length.ToString());



i我收到所有mail.i只想要未读邮件并将邮件移入垃圾箱

解决方案

我猜您使用的是Gmail IMAP4 服务器。



尝试使用 POP3 服务器。您只会收到新的电子邮件。

由于Gmail POP3服务器不像普通POP3服务器那样工作,即使电子邮件未被删除,它也会自动隐藏旧电子邮件,因此我们建议您使用IMAP4协议。


将邮件移到垃圾箱我们可以使用这段代码: -

 Imap4Folder [] folders = oClient.Imap4Folders; 
int count = folders.Length;
// 在我的GMAIL中我有两个floder INBOX和[Gmail]。[Gmail]包含7个subfloder。
// 在子浮动中我有一个垃圾桶。
for int FloderCount = 0 ; FloderCount < folders.Length; FloderCount ++)
{
Imap4Folder folder = folders [FloderCount];
if (folder.Name.Equals( [Gmail]))
{
// Name =[ Gmail]
Imap4Folder [] subfolder = folder.SubFolders;
for int SubFloderCount = 0 ; SubFloderCount < subfolder.Length; SubFloderCount ++)
{
// 检查垃圾邮件
if (子文件夹[SubFloderCount] .Name.Equals(< span class =code-string> Trash))
{
// 将邮件移至垃圾箱文件夹

oClient.Move(info,subfolder [SubFloderCount]);
} // 子文件夹,如果关闭
} // 关闭的子浮动
} // floder如果关闭
} // floder for close


Reading new mail and deleting mail using EAGetMail.Please send me some solution.i can successfully get all the mail but i dont want all mail i want only new unread mail.i have to delete the mail in my gmail account also or move the mail from inbox to trash
code :-

oClient = new MailClient("TryIt");
oServer.SSLConnection = true;
oServer.Port = 993;
oServer.User = "rms@convate.com";

oClient.GetMailInfosOption = GetMailInfosOptionType.NewOnly;
oClient.Connect(oServer);

if (oClient.Connected)
{
    MessageBox.Show("server is connected");
}

MailInfo[] infos = oClient.GetMailInfos();
MessageBox.Show(infos.Length.ToString());


i am getting all mail.i want only unread mail and move mails into trash

解决方案

I guess you are using Gmail IMAP4 server.

Try using POP3 server. You will get the new emails only.

Because Gmail POP3 server doesn't work like normal POP3 server, it hides old emails automatically even the email was not deleted, so we suggest that you use IMAP4 protocol.


moving the mail to the trash we can use this code:-

Imap4Folder[] folders = oClient.Imap4Folders;
          int count = folders.Length;
          //IN MY GMAIL i have two floder INBOX and [Gmail].[Gmail] contain 7 subfloder.
          //in the subfloder i have a trash floder.
         for (int FloderCount = 0; FloderCount < folders.Length; FloderCount++)
          {
              Imap4Folder folder = folders[FloderCount];
              if (folder.Name.Equals("[Gmail]"))
              {
                  //Name = "[Gmail]"
                  Imap4Folder[] subfolder = folder.SubFolders;
                  for (int SubFloderCount = 0; SubFloderCount < subfolder.Length; SubFloderCount++)
                  {
                       //checking for the trash floder   
                      if (subfolder[SubFloderCount].Name.Equals("Trash"))
                      {
                          //move a mail to  "Trash" folder

                          oClient.Move(info, subfolder[SubFloderCount]);
                      }//subfolder if close
                  }//subfloder for close
              }//floder if close
          }//floder for close


这篇关于使用EAGetMail阅读新邮件和删除邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆