http://files.cnblogs.com/aowind/RssReader2.rar
主要添加了一个mail.vb的窗体:
源代码如下:
Imports System.web.mail
Public Class mail
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.Button1 = New System.Windows.Forms.Button
Me.StatusBar1 = New System.Windows.Forms.StatusBar
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.Label6 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "收件人:"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(80, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(272, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(8, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 24)
Me.Label2.TabIndex = 2
Me.Label2.Text = "发信人:"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(80, 80)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(272, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.CheckBox1)
Me.GroupBox1.Controls.Add(Me.TextBox5)
Me.GroupBox1.Controls.Add(Me.TextBox4)
Me.GroupBox1.Controls.Add(Me.TextBox3)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(8, 120)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(344, 128)
Me.GroupBox1.TabIndex = 4
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "SMTP服务器设置"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(16, 24)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(96, 16)
Me.Label3.TabIndex = 0
Me.Label3.Text = "SMTP服务器:"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(16, 72)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(96, 16)
Me.Label4.TabIndex = 1
Me.Label4.Text = "账号:"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(16, 96)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(96, 16)
Me.Label5.TabIndex = 2
Me.Label5.Text = "密码:"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(96, 24)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(240, 21)
Me.TextBox3.TabIndex = 3
Me.TextBox3.Text = ""
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(96, 72)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(168, 21)
Me.TextBox4.TabIndex = 4
Me.TextBox4.Text = ""
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(96, 96)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(168, 21)
Me.TextBox5.TabIndex = 5
Me.TextBox5.Text = ""
'
'CheckBox1
'
Me.CheckBox1.Location = New System.Drawing.Point(24, 48)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(208, 24)
Me.CheckBox1.TabIndex = 6
Me.CheckBox1.Text = "需要身份验证"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(216, 248)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(128, 32)
Me.Button1.TabIndex = 5
Me.Button1.Text = "发送"
'
'StatusBar1
'
Me.StatusBar1.Location = New System.Drawing.Point(0, 292)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Size = New System.Drawing.Size(362, 22)
Me.StatusBar1.TabIndex = 6
Me.StatusBar1.Text = "StatusBar1"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(80, 48)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(272, 21)
Me.TextBox6.TabIndex = 8
Me.TextBox6.Text = ""
'
'Label6
'
Me.Label6.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(8, 48)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(56, 24)
Me.Label6.TabIndex = 7
Me.Label6.Text = "标题:"
'
'mail
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(362, 314)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.StatusBar1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Name = "mail"
Me.Text = "SendMail"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Public mail As New MailMessage
Public body As String
Public Sub stand(ByVal sbody As String, ByVal title As String)
TextBox6.Text = title
body = Replace(sbody, "UTF-8", "gb2312")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With mail
.To = TextBox1.Text
.From = TextBox2.Text
.Subject = TextBox6.Text
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", TextBox4.Text)
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", TextBox5.Text)
.BodyFormat = MailFormat.Html
.Body = body
End With
SmtpMail.SmtpServer = TextBox3.Text
SmtpMail.Send(mail)
MsgBox("发送成功")
End Sub
End Class
Public Class mail
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.CheckBox1 = New System.Windows.Forms.CheckBox
Me.Button1 = New System.Windows.Forms.Button
Me.StatusBar1 = New System.Windows.Forms.StatusBar
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.Label6 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "收件人:"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(80, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(272, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(8, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 24)
Me.Label2.TabIndex = 2
Me.Label2.Text = "发信人:"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(80, 80)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(272, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.CheckBox1)
Me.GroupBox1.Controls.Add(Me.TextBox5)
Me.GroupBox1.Controls.Add(Me.TextBox4)
Me.GroupBox1.Controls.Add(Me.TextBox3)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(8, 120)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(344, 128)
Me.GroupBox1.TabIndex = 4
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "SMTP服务器设置"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(16, 24)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(96, 16)
Me.Label3.TabIndex = 0
Me.Label3.Text = "SMTP服务器:"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(16, 72)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(96, 16)
Me.Label4.TabIndex = 1
Me.Label4.Text = "账号:"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(16, 96)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(96, 16)
Me.Label5.TabIndex = 2
Me.Label5.Text = "密码:"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(96, 24)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(240, 21)
Me.TextBox3.TabIndex = 3
Me.TextBox3.Text = ""
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(96, 72)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(168, 21)
Me.TextBox4.TabIndex = 4
Me.TextBox4.Text = ""
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(96, 96)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(168, 21)
Me.TextBox5.TabIndex = 5
Me.TextBox5.Text = ""
'
'CheckBox1
'
Me.CheckBox1.Location = New System.Drawing.Point(24, 48)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(208, 24)
Me.CheckBox1.TabIndex = 6
Me.CheckBox1.Text = "需要身份验证"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(216, 248)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(128, 32)
Me.Button1.TabIndex = 5
Me.Button1.Text = "发送"
'
'StatusBar1
'
Me.StatusBar1.Location = New System.Drawing.Point(0, 292)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Size = New System.Drawing.Size(362, 22)
Me.StatusBar1.TabIndex = 6
Me.StatusBar1.Text = "StatusBar1"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(80, 48)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(272, 21)
Me.TextBox6.TabIndex = 8
Me.TextBox6.Text = ""
'
'Label6
'
Me.Label6.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label6.Location = New System.Drawing.Point(8, 48)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(56, 24)
Me.Label6.TabIndex = 7
Me.Label6.Text = "标题:"
'
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(362, 314)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.StatusBar1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Name = "mail"
Me.Text = "SendMail"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Public mail As New MailMessage
Public body As String
Public Sub stand(ByVal sbody As String, ByVal title As String)
TextBox6.Text = title
body = Replace(sbody, "UTF-8", "gb2312")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With mail
.To = TextBox1.Text
.From = TextBox2.Text
.Subject = TextBox6.Text
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", TextBox4.Text)
.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", TextBox5.Text)
.BodyFormat = MailFormat.Html
.Body = body
End With
SmtpMail.SmtpServer = TextBox3.Text
SmtpMail.Send(mail)
MsgBox("发送成功")
End Sub
End Class
在菜单内加入“发送文章给朋友”选项,name=FileSendMail, enabled=false
在loadhtml()过程里加上
FileSendMail.Enabled = True
再在主窗体上加上下面事件处理过程
Private Sub FileSendMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileSendMail.Click
Dim smail As New mail
smail.stand(cbii.TopicContents, cbii.TopicTitle)
smail.ShowDialog()
End Sub
Dim smail As New mail
smail.stand(cbii.TopicContents, cbii.TopicTitle)
smail.ShowDialog()
End Sub
唉!下午公司网络出了问题,去买了一个MODEM,带路由功能,用起来还没有原来的不带路由功能的好用!
浪费了一下午时间,这个功能也就勿勿而就