O'Reilly logo

Visual Basic 2008 Recipes: A Problem-Solution Approach by Rakesh Rajan, Matthew MacDonald, Allen Jones, Todd Herman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.7. Send E-mail Using SMTP

Problem

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

Solution

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
PropertyDescription
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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required