Skip to content

Trigger Inbound Rules

Igor Balos edited this page Nov 13, 2017 · 2 revisions

Inbound rules allow you to filter out email which is going to be processed. If it matches rules, it can be rejected.

For these API requests you will need to use a server API token. Once you obtain it, you will need to use server API client.

ApiClient client = Postmark.getApiClient(<server token>);

Create an inbound rule.

// create inbound rule
InboundRuleResponse rule = client.createInboundRule("igor@example.com");
Integer ruleId = rule.getId();

List all inbound rules.

// list inbound rules
InboundRules rules = client.getInboundRules(Parameters.init().build("offset",0).build("count",4));
System.out.println(rules.getInboundRules().get(0).getRule());

Delete an inbound rule.

// delete inbound rule
String response = client.deleteInboundRule(ruleId);