SmtpMail and MailMessage : Send mails in .NET - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- SmtpMail and MailMessage : Send mails in .NET (http://www.webasp.net/article/4/3995.htm) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- 作者:未知 -- 发布日期: 2003-07-12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
The SmtpMail class can be used to send from your C# application. Mail is by default queued on the system, ensuring that the calling program does not block network traffic. The SmtpMail class is defined in the namespace System.Web.Util. You need to call
before you use SmtpMail. This class has only one member function Send. Send sends a mail message. The Send method is overloaded. Either a MailMessage class or four arguments can be passed to the Send message. You can call the Send method in two manners:
Or, if you don't want to call System.Web.Util.
You can call the Send method in two ways. 1. By passing MailMessage as a parameter
Here MailMessage is a class.
2. Direct method.
Example:
The MailMessage Class The MailMessage class can be used to send mails with cc, bcc or attachments. The MailMessage constructor initializes a new instance of the MailMessage class. It doesn't take any parameters.
Each member of this class are pretty easy to understand. Say you want to send an attachment with the mail. You use Attachment member to attach the mail. Say I want to attach mcb.jpg with the mail.
Each member of this class are pretty easy to understand. Say you want to send an attachment with the mail. You use Attachment member to attach the mail. Other MailMessage members have been used in the above example. About the Author: Mahesh is Admin and the founder of this site. He has been programming in C++, MFC, Visual Basic, COM, ATL over 5 years. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| webasp.net |