-
Notifications
You must be signed in to change notification settings - Fork 48
Using System.Net.Mail.MailMessage
JP Toto edited this page Nov 19, 2013
·
6 revisions
You can also use System.Net.Mail.MailMessage to compose message objects to send through Postmark.
string to = "Some User <[email protected]>";
string from = "Another User <[email protected]>";
var mailMessage = new System.Net.MailMailMessage(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);
We'll need a PostmarkClient object in order to send our message.
var newClient = new PostmarkClient("server_token");
Now we're ready to send our message.
var response = newClient.SendMessage(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