Search Wiki:

Send E-mail

A simple C#/VB.NET code snippet for sending an SMTP-based e-mail message. It supports multiple recipients but does not support attachments.

Sending E-mail

Sending a quick e-mail message using this code snippet is simple:
  1. Download the source code from the Releases tab.
  2. Copy the C# or VB.NET version of the SendMessage method to your project.
  3. Modify the Client.Host property within the SendMessage method to point to your SMTP server (look for the "TODO" in the source code).
  4. Call the SendMessage method passing in the appropriate arguments.

Here are a couple of examples:

C#
  // Send a quick e-mail message
  SendEmail.SendMessage("This is a Test", 
     "This is a test message...",
     "noboday@nowhere.com",
     "somebody@somewhere.com", 
     "ccme@somewhere.com");

VB.NET
  ' Send a quick e-mail message
  SendEmail.SendMessage("This is a Test", _
     "This is a test message...", _
     "noboday@nowhere.com", _
     "somebody@somewhere.com", _
     "ccme@somewhere.com")

Supported .NET Framework Versions
- .NET Framework 2.0
- .NET Framework 3.0
- .NET Framework 3.5
Last edited Feb 13 at 1:01 PM  by jbramwell, version 6
Updating...
Page view tracker