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:
- Download the source code from the Releases tab.
- Copy the C# or VB.NET version of the SendMessage method to your project.
- Modify the Client.Host property within the SendMessage method to point to your SMTP server (look for the "TODO" in the source code).
- 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
|