Use Visual C # to send an email

Source: Internet
Author: User
Tags mailmessage
Visual C # is the next-generation programming language launched by Microsoft. It not only has the powerful features of Visual C ++, but also has the concise and easy-to-use features of Visual Basic. So once launched, we were welcomed by the majority of program developers. One obvious difference between Visual C # and Visual C ++ is that Visual C # itself has no class libraries, while Visual C ++ itself has class libraries. Although Visual C # does not have a class library, it is a very important development language in the. Net Framework. He can use the. Net FrameWork SDK, a common software development kit provided by the. Net FrameWork. This software development kit can be said to be an extension of the Visual C # function. Visual C # is a multi-function that cannot be implemented by itself. This article describes how Visual C # uses this software development kit to send emails.
I. Environment settings for software development and operation:
I>. Windows 2000 Server Edition
II>. Net FrameWork SDK Beta 2
III>. Open "control panel", go to "add and delete programs", and then click "add/delete Windows components". The following page is displayed:

Figure 01: System Configuration page
Click "Internet Information Service (IIS)" and click "details". The following page is displayed:

Figure 02: System Configuration page
Click "SMTP Serverce", and then click "OK. Then press "next", the system will install the SMTP Service required by the program.
II. Visual C # How to send an email:
In. Net FrameWork SDK Beta 2, there is a namespace called System. Web. Mail, which encapsulates the methods, objects, and attributes for sending emails. Visual C # sends an email by calling methods, objects, and attributes in the namespace. In this article, email sending mainly uses two objects: one is the MailMessage object, which encapsulates all attributes of the email, that is, the so-called sender and recipient, the subject of the letter, the content of the letter, and the attachment of the letter. The other one is the SmtpMail object. The maximum function of this object is to Send the MailMessage object with various attributes defined. To complete this function, you need to call the Send () of the SmtpMail object () method.
Related Article

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.