手机
当前位置:查字典教程网 >编程开发 >C#教程 >c#使用S22.Imap收剑灵激活码邮件代码示例(imap收邮件)
c#使用S22.Imap收剑灵激活码邮件代码示例(imap收邮件)
摘要:复制代码代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.Compo...

复制代码 代码如下:

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"));

// 也可以使用通过其它条件进行检索你的邮件

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("服务器拒绝连接,可能密码错误!");

imap.Dispose();

}

}

}

}

【c#使用S22.Imap收剑灵激活码邮件代码示例(imap收邮件)】相关文章:

将字符串转换成System.Drawing.Color类型的方法

C#委托初级使用的实例代码

c#(Socket)异步套接字代码示例

C#使用非托管代码直接修改字符串的方法

C#使用itextsharp生成PDF文件的实现代码

c# SendMail发送邮件实例代码

使用 C# 动态编译代码和执行的代码

C#操作图片读取和存储SQLserver实现代码

C# Stream 和 byte[] 之间的转换

C#生成注册码的实例代码

精品推荐
分类导航