Dim Mail As Mail.SmtpMail
Dim mailMsg As New Mail.MailMessage
'收件人地址
mailMsg.To = Me.txtTo.Text
'发件人地址
mailMsg.From = "wanfangsoft@126.com"
'邮件主题
mailMsg.Subject = Me.txtSubject.Text
'邮件内容
mailMsg.Body = Me.txtContent.Text
'支持服务器验证
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
'用户名
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "wanfangsoft@126.com")
'密码
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "05732718930")
Try
Mail.SmtpServer = "smtp.126.com"
Mail.Send(mailMsg)
Me.Session.Remove("email")
Me.Session.Remove("key")
Me.Session.Remove("startdate")
Me.Session.Remove("enddate")
Me.Session.Remove("state")
Me.lblMsg.Text = "发送成功!"
Catch ex As Exception
Me.lblMsg.Text = "请关闭杀毒软件邮件监控,重新发送。"
End Try