[Learning diary] record the EAMIL sending method of brother Tang, and change it to vb.net.

Source: Internet
Author: User
Tags mailmessage
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.