Skip to content

Processing Inbound Email

Vlad-Cosmin Sandu edited this page Jul 7, 2020 · 5 revisions

The Postmark API provides powerful features to process inbound messages. You can use PostmarkClient to retrieve these messages.

Get Inbound Messages:

var client = new PostmarkClient("<server token>");

var matchedInboundMessages = await client
	.GetInboundMessagesAsync(0, 100, "[email protected]", 
	"[email protected]", 
	"Reply to this message verify your email address.");

Get A Single Inbound Message:

var client = new PostmarkClient("<server token>");

var inboundMessageId = "a message id";
var inboundMessage = await client
	.GetInboundMessageDetailsAsync(inboundMessageId);

Bypass Inbound Rule for Message:

See Inbound Rules for more information.

var client = new PostmarkClient("<server token>");

var inboundMessageId = "a message id";
var bypassResult = await client
	.BypassBlockedInboundMessage(inboundMessageId);

Parsing Inbound Webhook data

See Inbound Webhooks for more information.

You can use the PostmarkInboundWebhookMessage model to represent the data received via the Inbound Webhook.

// Example implementing an Inbound Webhook endpoint in ASP.NET Web API
[HttpPost]
public async Task<IActionResult> PostInboundWebhook(PostmarkInboundWebhookMessage message)
{
    // Process the inbound hook data
    return NoContent();
}
Clone this wiki locally