网上关于接收电子邮件的代码很多,试用后,能满足要求的甚少。OpenPop(http://sourceforge.net/projects/hpop/)现在有了新的版本,且能经过VS2010编译,值得使用。可惜的是我现在对C#不熟悉,其demo经研究后转成VB.net实现。
OpenPOP的test截图:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
_
Partial Class FetchEmail
System.Windows.Forms.Form
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As
Boolean)
Try
disposing AndAlso components IsNot Nothing
Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
Try
components As System.ComponentModel.IContainer
Windows 窗体设计器修改它。
<System.Diagnostics.DebuggerStepThrough()> _
Sub InitializeComponent()
Me.Label1 = New
System.Windows.Forms.Label()
Me.txtPOP3Server = New
System.Windows.Forms.TextBox()
Me.btnFetchEmail = New
System.Windows.Forms.Button()
Me.txtPort = New
System.Windows.Forms.TextBox()
Me.Label2 = New
System.Windows.Forms.Label()
Me.txtName = New
System.Windows.Forms.TextBox()
Me.Label3 = New
System.Windows.Forms.Label()
Me.txtPassword = New
System.Windows.Forms.TextBox()
Me.Label4 = New
System.Windows.Forms.Label()
Me.txtEmailCount = New
System.Windows.Forms.TextBox()
Me.Label5 = New
System.Windows.Forms.Label()
Me.txtRead = New
System.Windows.Forms.TextBox()
Me.Label6 = New
System.Windows.Forms.Label()
Me.txtBody = New
System.Windows.Forms.TextBox()
Me.txtFrom = New
System.Windows.Forms.TextBox()
Me.Label7 = New
System.Windows.Forms.Label()
Me.Label8 = New
System.Windows.Forms.Label()
Me.Label9 = New
System.Windows.Forms.Label()
Me.txtSubject = New
System.Windows.Forms.TextBox()
Me.Label10 = New
System.Windows.Forms.Label()
Me.lstAttachments = New
System.Windows.Forms.ListBox()
Me.btnConnectLogin = New
System.Windows.Forms.Button()
Me.TableLayoutPanel1 = New
System.Windows.Forms.TableLayoutPanel()
Me.TableLayoutPanel1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
True
System.Windows.Forms.DockStyle.Right
Me.Label1.Location = New System.Drawing.Point(13,
10)
"Label1"
System.Drawing.Size(99, 35)