资源简介
在某一哥们的修改的接收中文邮件不乱码的OpenPOP基础上,加上SSL的pop3连接,使之能正常接收如GMail邮件.内有Demo
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenPOP.POP3;
using System.Collections;
using OpenPOP.MIMEParser;
namespace CuteMail
{
public partial class frmCuteMail : Form
{
ReceiveMail messageBox;
private string txtmessage=““;
private OpenPOP.MIMEParser.Message m = null;
public frmCuteMail()
{
InitializeComponent();
readButton.Enabled = false;
saveButton.Enabled = false;
changeButton.Enabled = false;
messageNO.ReadOnly = true;
}
private void init()
{
readButton.Enabled = false;
saveButton.Enabled = false;
messageNO.ReadOnly = true;
string popServer = txtPOP.Text;
string login = txtLogin.Text;
string password = txtPassword.Text;
string port = txtPort.Text;
//GMail改成995端口
bool userSSL = chkSSL.Checked;
messageBox = new ReceiveMail(popServerportloginpassworduserSSL);
int count = messageBox.connect();
messageCount.Text = count + ““;
changeButton.Enabled = false;
subjectText.Text = ““;
attachmentName.Text = ““;
txtPanel.Controls.Clear();
readButton.Enabled = true;
saveButton.Enabled = true;
messageNO.ReadOnly = false;
}
private void readButton_Click(object sender EventArgs e)
{
changeButton.Enabled = true;
subjectText.Text = ““;
attachmentName.Text = ““;
int index = Int16.Parse(messageNO.Text);
bool hasAttachment = messageBox.setMessage(index);
ArrayList name = new ArrayList();
m = messageBox.currentMessage;
int count = m.AttachmentCount;
for (int i = 0; i < count; i++)
{
if (m.GetAttachment(i).NotAttachment)
continue;
name.Add(m.GetAttachmentFileName(m.GetAttachment(i)));
}
messageBox.setMessage(index);
int number = name.Count;
string names = ““;
for (int i = 0; i < number; i++)
{
names = names + name[i].ToString() + “ “;
}
attachmentName.Text = names;
subjectText.Text = m.Subject;
txtmessage = (string)m.MessageBody[0];
showMessage(!m.HTML);
}
private void showMessage(bool HTML)
{
if (!HTML)
{
txtPanel.Controls.Clear();
TextBox txtBox = new TextBox();
txtBox.Multiline = true;
txtBox.Text = txtme
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 28672 2009-02-19 13:36 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\CuteMail.exe
文件 30208 2009-02-19 13:36 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\CuteMail.pdb
文件 5632 2005-11-11 22:25 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\CuteMail.vshost.exe
文件 69632 2009-02-19 11:20 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\MIMEParser.dll
文件 134656 2009-02-19 11:20 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\MIMEParser.pdb
文件 28672 2009-02-19 11:55 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\OpenPOP.dll
文件 2036 2009-02-19 11:39 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\OpenPOP.log
文件 46592 2009-02-19 11:55 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\OpenPOP.pdb
文件 3232 2007-03-13 03:23 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\OpenPOP.txt
文件 199 2007-03-13 04:22 OpenPOP_haozes\CuteMail\CuteMail\bin\Debug\新建 文本文档.txt
文件 3685 2007-03-09 23:37 OpenPOP_haozes\CuteMail\CuteMail\CuteMail.csproj
文件 4202 2009-02-19 13:39 OpenPOP_haozes\CuteMail\CuteMail\frmCuteMail.cs
文件 13955 2009-02-19 13:39 OpenPOP_haozes\CuteMail\CuteMail\frmCuteMail.Designer.cs
文件 5814 2009-02-19 13:39 OpenPOP_haozes\CuteMail\CuteMail\frmCuteMail.resx
文件 1770 2004-06-16 19:42 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\AssemblyInfo.cs
文件 69632 2009-02-19 11:20 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\bin\Debug\MIMEParser.dll
文件 134656 2009-02-19 11:20 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\bin\Debug\MIMEParser.pdb
文件 61440 2007-03-09 18:54 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\bin\Release\MIMEParser.dll
文件 17391 2007-03-14 11:16 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\Attachment.cs
文件 1420 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\Common.cs
文件 5290 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\DecodeQP.cs
文件 1261 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\Exceptions.cs
文件 40386 2007-03-13 21:17 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\Message.cs
文件 17303 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\MIMETypes.cs
文件 3798 2004-06-02 09:17 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\QuotedCoding.cs
文件 2554 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\TNEFAttachment.cs
文件 12989 2004-06-16 14:00 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\TNEFParser.cs
文件 18821 2007-03-14 10:37 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIME\Utility.cs
文件 4378 2007-03-09 18:53 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIMEParser.csproj
文件 2081 2007-03-09 18:53 OpenPOP_haozes\CuteMail\CuteMail\MIMEParser\MIMEParser.csproj.user
............此处省略170个文件信息
- 上一篇:ansys变压器仿真
- 下一篇:山东大学操作系统实验六报告
评论
共有 条评论