Send e-mail messages in Visual C #

Source: Internet
Author: User
Tags mail mailmessage

Visual C # is the next-generation program development language introduced by Microsoft. He not only has the powerful features of Visual C + +, but also has the simplicity of Visual Basic, easy to start features. So once launched, it received a large number of program developers welcome. One obvious difference between Visual C # and Visual C + + is that Visual C # itself is not a class library, and Visual C + + is itself with a class library. Visual C # Although there is no class library, but as. NET Framework, a very important development language. He can use it. NET Framework provides a common software development package--. NET Framework SDK. This software development package can be said to be an extension of Visual C # functionality that Visual C # uses to achieve many of the functions that it cannot achieve. This article is an introduction to how Visual C # uses this software development package to send e-mail.

A Environment settings for software development and operation:

I > Windows System 2000 Server Edition

II >.. Net FrameWork SDK Beta version 2

III >. Open Control Panel, go to add and Remove Programs, and then click Add/Remove Windows components to see the following interface:

Figure 01: System Configuration Interface

Click "Internet Information Services (IIS)" and then tap "Details" to get the following interface:

Figure 02: System Configuration Interface

Click the SMTP serverce option in the click, and then press the OK button. Then press the Next button, and after the system restarts, the SMTP service required to run this program will be installed.

Two How Visual C # sends e-mail:

In the. Net FrameWork SDK Beta 2, there is a namespace called System.Web.Mail, which encapsulates the methods, objects, and properties that send e-mail messages in this namespace. Visual C # is the e-mail message that is sent by calling methods, objects, and properties in this namespace. In this article, two objects are used to send e-mail: one is the MailMessage object, which encapsulates the various attributes of an e-mail message, that is, the sender, the addressee, the subject of the letter, the content of the letter, and the attachment of the letter. The other is the SmtpMail object, the object's biggest role is to have defined the properties of the MailMessage object to send out, and complete this function, you need to call the SmtpMail object's Send () method.

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.