Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'邮件信息
Dim mail As New MailMessage
'发送者地址
mail.From = New MailAddress("username@163.com")
'收件者集合
mail.To.Add(New MailAddress(TextBox2.Text))
'邮件内容
mail.Body = TextBox1.Text
'密抄送集合
mail.Bcc.Add(New MailAddress("a@xxx.com"))
'抄送集合
mail.CC.Add(New MailAddress("c@xxx.com"))
'邮件内容是否为HTML
mail.IsBodyHtml = True
'回复地址
mail.ReplyTo = New MailAddress("d@xxx.com")
'主题
mail.Subject = "测试"
'发送邮件的对象
Dim smtp As New SmtpClient()
'是否进行ssl加密,gmail和qq邮箱此处需要为true
smtp.EnableSsl = True
'邮箱登陆信息
smtp.Credentials = New NetworkCredential("username", "password")
'邮箱smtp服务器
smtp.Host = "smtp.163.com"
smtp.Send(mail)
End Sub
End Class