11.7. Send E-mail Using SMTP


You need to send e-mail using an SMTP server.


Use the SmtpClient and MailMessage classes in the System.Net.Mail namespace.

How It Works

An instance of the SmtpClient class provides the mechanism through which you communicate with the SMTP server. You configure the SmtpClient using the properties described in Table 11-3.

Table 11.3. Properties of the SmtpClient Class
ClientCertificatesGets a System.Security.Cryptography.X509Certificates.X509CertificatesCollection to which you add the certificates to use for communicating with the SMTP server (if required).
CredentialsGets or sets an implementation of the System.Net.ICredentialsByHost interface that represents the credentials to use ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.