欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

c#使用S22.Imap收劍靈激活碼郵件代碼示例(imap收郵件)

 更新時(shí)間:2013年12月26日 11:33:09   作者:  
一個IMAP收發(fā)郵件的類庫S22.IMAP,方便易用,下面來個例子可以收劍靈激活碼郵件

復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using S22.Imap;

namespace _163pop3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        /*
 * 
 *  By im0khu 
 *  C#利用IMAP收郵件
 */
        private void btnFetch_Click(object sender, EventArgs e)
        {

            string ImapServer = "imap.163.com";
            string ImapUserame = "xiagegou_com";
            string ImapPwd = "password2013";
            ImapClient imap = new ImapClient(ImapServer, 993, true);

            try
            {
                imap.Login(ImapUserame, ImapPwd, AuthMethod.Login);
                uint[] uids = imap.Search(SearchCondition.Subject("This's a test email"));
               // uint[] uids = imap.Search(SearchCondition.From("ssss@oschina.net"));
      // 也可以使用通過其它條件進(jìn)行檢索你的郵件
               if (uids.Length > 0)
                {
                    System.Net.Mail.MailMessage msg = imap.GetMessage(uids[0]);
                    emailLst.Items.Add("Subject: " + msg.Subject);
                    emailBody.Text = msg.Body;                  

                }
                else
                {
                    emailLst.Items.Add("沒有你要找的郵件");
                }
                imap.Dispose();

            }
            catch (InvalidCredentialsException)
            {
                MessageBox.Show("服務(wù)器拒絕連接,可能密碼錯誤!");
                imap.Dispose();
            }
        }
    }
}

相關(guān)文章

最新評論