Imports system. web. mail
Of course, this namespace cannot be used directly when vb.net is used for development on the VS.net platform. You must first reference system. web. dll in reference.
The main sending code is As follows: Dim mail As MailMessage = New MailMessage
Mail. To = "heqiang01@163.com, aowind@163.com"
Mail. From = "aowind@163.com"
Mail. Subject = "this is a test email ."
Mail. Body = "<B> Some text goes here </B>"
Mail. BodyFormat = MailFormat. Html 'is set to HTML Format
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'is set to require user authentication
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendusername", "aowind") 'sets the authentication Username
Mail. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxxxx") 'sets the verification Password
SmtpMail. SmtpServer = "smtp.163.com" 'email server address
SmtpMail. Send (mail)
Of course, the password cannot be written, hey!
In mail. to, the value assigned here is the recipient's address. You can write multiple addresses and separate them.
The key lies in the need for identity verification, so here is the code for implementing identity verification. Thank you, Brother Tang.
Of course, you don't need to verify your own mail server.