- Part 5
Implementing interoperability, reflection, and mailing functionality in a .NET Framework application
- Topic 1
Send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery from a .NET Framework application. (Refer System.Net.Mail namespace)
- MailMessage class
- MailAddress class and MailAddressCollection class
- SmtpClient class, SmtpPermission class, and SmtpPermissionAttribute class
- Attachment class, AttachmentBase class, and AttachmentCollection class
- SmtpException class, SmtpFailedReceipientException class, and SmtpFailedReceipientsException class
- SendCompleteEventHandler delegate
- LinkedResource class and LinkedResourceCollection class
- AlternateView class and AlternateViewCollection class
This section includes a lot of new classes new to .Net 2.0. These are used to send e-mails.
The MailMessage Class is new to .Net 2.0 and represents an email that can be sent with the SmtpClient.
The MailAddress Class represent an email address and the MailAddressCollection represents a collection of email addresses. A Collection is tied to the To, Bcc and CC properties of the Mail Message Class.
The SmtpClient Class is used to send the Mail Message. Messages can be sent asynchronously with this class as well.
The SmtpPermission and SmtpPermissionAttribute are used to demand or assert code access permission to send through a StmpClient
The Attachment Class represent an attachment to an email. The Attachment Base is the base class for the attachment class and the AttachmentCollection class represents a collection of attachments.
The SmtpException Class is the exception that is thrown when the Send or SendAsync methods of the SmtpClient are not able to complete. The SmtpFailedReceipient Exception and SmtpFailedRecepients Exception are thrown when the Send or SendAsync methods of the SmtpClient are not able to deliver the message to one or all of the receipients.
The SendCompleteEventHandler Deletegate is used as the event that is fired when the the Email is finished being sent and is usually used when the SendAsync method of the SmtpClient finishes.
The LinkedResource Class, which derives from AttachmentBase, represents an external resources embedded in a mail message. The LinkedResourceCollection represents a collection of embedded resources.
The AlternateView Class, which derives from AttachmentBase, represents an alternative view of the mail message itself. This is used so that an html version of an email can also attach a non html view of the same message for use by email readers that can not view html content. The AlternativeViewCollection is a collection of these alternative formatted messages.
Other Resources & Links: