首页 技术 正文
技术 2022年11月19日
0 收藏 489 点赞 4,372 浏览 2415 个字

一:LumiSoft.Net简介

Lumisoft is a software development company specialised in mobile phones and tablets. Our products make useful information available to mobile devices with a unique advantage: exceptional spee

源码下载地址:http://files.cnblogs.com/files/sunyj/LumiSoft.Net-master.zip

https://svn.lumisoft.ee:8443/svn/
User:     readonly
Password: readonly

二:收邮件

开发前需要引用LumiSoft.Net.dll文件,下载地址:http://files.cnblogs.com/files/sunyj/LumiSoft.Net.rar

using LumiSoft.Net;
using LumiSoft.Net.Mail;
using LumiSoft.Net.POP3.Client;using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace WinPop3
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent(); using (POP3_Client c = new POP3_Client())
{
//连接POP3服务器
c.Connect("pop3.163.com", WellKnownPorts.POP3);
//验证用户身份
c.Login("********@163.com", "邮件密码/smtp、pop3授权码");
if (c.Messages.Count > )
{
//遍历收件箱里的每一封邮件
foreach (POP3_ClientMessage message in c.Messages)
{
try
{
//mail.MarkForDeletion(); //删除邮件 //收件人、发件人、主题、时间等等走在mime_header里获得
Mail_Message mime_header = Mail_Message.ParseFromByte(message.HeaderToByte()); //发件人
if (mime_header.From != null)
{
string displayname = mime_header.From[].DisplayName;
string from = mime_header.From[].Address;
} //收件人
if (mime_header.To != null)
{
StringBuilder sb = new StringBuilder();
foreach (Mail_t_Mailbox recipient in mime_header.To.Mailboxes)
{
string displayname = recipient.DisplayName;
string address = recipient.Address;
if (!string.IsNullOrEmpty(displayname))
{
sb.AppendFormat("{0}({1});", displayname, address);
}
else
{
sb.AppendFormat("{0};", address);
}
}
} //抄送
if (mime_header.Cc != null)
{
StringBuilder sb = new StringBuilder();
foreach (Mail_t_Mailbox recipient in mime_header.Cc.Mailboxes)
{
string displayname = recipient.DisplayName;
string address = recipient.Address;
if (!string.IsNullOrEmpty(displayname))
{
sb.AppendFormat("{0}({1});", displayname, address);
}
else
{
sb.AppendFormat("{0};", address);
}
}
} //发送邮件时间
DateTime dateTime = mime_header.Date;
string ContentID = mime_header.ContentID;
string MessageID = mime_header.MessageID;
string OrgMessageID = mime_header.OriginalMessageID;
string Subject = mime_header.Subject; byte[] messageBytes = message.MessageToByte(); Mail_Message mime_message = Mail_Message.ParseFromByte(messageBytes);
if (mime_message == null)
{
continue;
}
string Body = mime_message.BodyText;
try
{
if (!string.IsNullOrEmpty(mime_message.BodyHtmlText))
{
//邮件内容
string BodyHtml = mime_message.BodyHtmlText;
}
}
catch
{ }
}
catch (Exception ex)
{ }
}
}
}
}
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,999
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,511
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,357
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,140
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,770
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,848