-
Notifications
You must be signed in to change notification settings - Fork 48
Using System.Net.Mail.MailMessage
Andrew Theken edited this page Dec 11, 2014
·
6 revisions
On plaforms that include the System.Net.Mail
assembly, you may make use the system-provied MailMessage
class to compose messages.
var to = "Some User <[email protected]>";
var from = "Another User <[email protected]>";
var mailMessage = new System.Net.Mail.MailMessage(from, to);
mailMessage.Subject = "Sending with Dotnet!";
mailMessage.Body = "Test Message";
The PostmarkMessage
class accepts a MailMessage
object as a constructor parameter:
var postmarkMessage = new PostmarkMessage(mailMessage);
After you have acquired the postmarkMessage
object, you may send it using the PostmarkClient
as described on the Sending-text-and-html-emails wiki article.
Note: In the 2.x library, you can send a MailMessage
using the PostmarkClient
without first converting it to a PostmarkMessage
.
The Postmark.Net client can be installed from NuGet.
For additional information about the capabilities of the Postmark API, see http://developer.postmarkapp.com/.
- Getting Started
- Version 2.0 Upgrade Guide
- Sending Email
- Searching Sent Messages
- Analyzing Sent Messages
- Processing Inbound Email
- Retrieving Message Statistics
- Handling Bounces
- Managing Suppressions
- Working with Message Streams
- Managing Your Account
- Troubleshooting Async&Await
- Version 1.x Overview
- Sending Email
- Sending Batch Emails
- Sending Attachments
- Sending Inline Images
- Using
MailMessage
- Using the Bounce API
- [Getting Send Statistics](Sending Statistics)
- Adding Custom Email Headers