1Dim mail As New MailMessage()
2 mail.To = mailTo.Text
3 mail.From = "gghouse@163.com"
4 mail.Subject = mailSubject.Text
5 mail.BodyFormat = MailFormat.Text
6 mail.Body = mailBody.Text
7 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
8 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "xxx@163.com")
9 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxx的密码")
10
11 On Error Resume Next
12SmtpMail.SmtpServer = "smtp.163.com"
13SmtpMail.Send( mail )
14
15
之前有做过邮件发送的,不过下面第7行开始的东西对我来说还是新知识
2 mail.To = mailTo.Text
3 mail.From = "gghouse@163.com"
4 mail.Subject = mailSubject.Text
5 mail.BodyFormat = MailFormat.Text
6 mail.Body = mailBody.Text
7 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
8 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "xxx@163.com")
9 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxx的密码")
10
11 On Error Resume Next
12SmtpMail.SmtpServer = "smtp.163.com"
13SmtpMail.Send( mail )
14
15