Class Library Reference


.NET Framework Class Library
System.Net.Mail Namespace

Note: This namespace is new in the .NET Framework version 2.0.

The System.Net.Mail namespace contains classes used to send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery.

The MailMessage class represents the content of a mail message. The SmtpClient class transmits email to the SMTP host that you designate for mail delivery. You can create mail attachments using the Attachment class.

Classes

 ClassDescription
Public classAlternateViewRepresents the format to view an email message.
Public classAlternateViewCollectionRepresents a collection of AlternateView objects.
Public classAttachmentRepresents an attachment to an e-mail.
Public classAttachmentBaseBase class that represents an email attachment. Classes Attachment, Alternateview, and LinkedResource derive from this class.
Public classAttachmentCollectionStores attachments to be sent as part of an e-mail message.
Public classLinkedResourceRepresents an embedded external resource in an email attachment, such as an image in an HTML attachment.
Public classLinkedResourceCollectionStores linked resources to be sent as part of an e-mail message.
Public classMailAddressRepresents the address of an electronic mail sender or recipient.
Public classMailAddressCollectionStore e-mail addresses that are associated with an e-mail message.
Public classMailMessageRepresents an e-mail message that can be sent using the SmtpClient class.
Public classSmtpClientAllows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP).
Public classSmtpExceptionRepresents the exception that is thrown when the SmtpClient is not able to complete a Send or SendAsync operation.
Public classSmtpFailedRecipientExceptionRepresents the exception that is thrown when the SmtpClient is not able to complete a Send or SendAsync operation to a particular recipient.
Public classSmtpFailedRecipientsExceptionThe exception that is thrown when e-mail is sent using an SmtpClient and cannot be delivered to all recipients.
Public classSmtpPermissionControls access to Simple Mail Transport Protocol (SMTP) servers.
Public classSmtpPermissionAttributeControls access to Simple Mail Transport Protocol (SMTP) servers.
Delegates

 DelegateDescription
Public delegateSendCompletedEventHandlerRepresents the method that will handle the SendCompleted event.
Enumerations

 EnumerationDescription
Public enumerationDeliveryNotificationOptionsDescribes the delivery notification options for e-mail.
Public enumerationMailPrioritySpecifies the priority of a MailMessage.
Public enumerationSmtpAccessSpecifies the level of access allowed to a Simple Mail Transport Protocol (SMTP) server.
Public enumerationSmtpDeliveryMethodSpecifies how email messages are delivered.
Public enumerationSmtpStatusCodeSpecifies the outcome of sending e-mail by using the SmtpClient class.
Tags :


Community Content

Homer P Simpson
Consider using System.Web.Mail instead if your application runs on an NT server

Consider using System.Web.Mail instead, and drop the mail in your local mail queue with your current credentials.

In order to avoid the "try 5 times until the external smtp server happens to be awake", you can drop mail in your local queue (it is the file system, and it is not busy, crashed, or otherwise unavailable, or your code wouldn't be running in the first place.

1) If you are connected to the internet, NT will immediately deliver the mail correctly to the recipient's email server with no delays or detours. If the recipient mail server delivers mail instantaneously, the recipient will see your mail, before your finger leaves the keyboard. No settings are necessary; the internet just works...

2) If you go through a proxy, because your firewall prevents you from accessing the internet, or because you want better protection against accidentally sending bad content, your NT mail demon will deliver the mail to the proxy instead. Your mail proxy may require user name and password, and may have restrictions on outgoing email addresses, etc. The proxy will deliver the mail whenever the proxy policies are scheduled.

3) If there is a delivery problem, your mail is left in the outgoing queue until it is successfuly sent.

***The System.Web.Mail has been depreciated as of v2.0***

Tags :

mikepope
Embedding an image

I added an example of how to embed (as opposed to attach) an image under LinkedResource class:

 

http://msdnwiki.microsoft.com/en-us/mtpswiki/system.net.mail.linkedresource(VS.80).aspx

 

I'm putting a note here because I myself found it confusing where to look when I wanted to do that, and I think a lot of people likewise have not known where to look for this information.

Tags :

Page view tracker