学习了VB.net如何发送邮件的方法,为了防止忘记,记下来~
Imports System.Net.Mail
Imports System.IO
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SenderName = TextBox5.Text
SenderSMTP = TextBox6.Text '需要使用的SMTP服务器
SenderPW = TextBox7.Text '发送邮件的邮箱的密码
Senders = SenderName & "@" & SenderSMTP & ComboBox1.Text '完整的邮箱地址比如example@126.com
Reciver = TextBox1.Text '接收者邮箱
SubTitle = TextBox2.Text '邮件标题
Acticle = TextBox3.Text '邮件正文
Path = TextBox4.Text '附件地址
If Reciver = "" Then
MsgBox("没有输入收件人!", vbOKOnly + vbInformation, "错误")
Exit Sub
End If
If SenderName = "" Then
MsgBox("