Skip to content

Senders

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

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

AccountApiClient client = Postmark.getAccountApiClient(<account token>);

You can easily list and manage all sender signatures within your account.

// list sender signatures
Signatures senders = client.getSenderSignatures(Parameters.init().build("count",6).build("offset",0));
Integer senderId = senders.getSenderSignatures().get(0).getId();

Retrieve sender signature details.

// list sender signature details
SignatureDetails senderDetails = client.getSenderSignatureDetails(senderId);
System.out.println(senderDetails.getConfirmed());

Create a new sender signature.

SignatureToCreate signature = new SignatureToCreate();
signature.setFromEmail("[email protected]");
signature.setName("John Smith");
signature.setReplyToEmail("[email protected]");

// create sender signature
SignatureDetails senderDetails = client.createSenderSignature(signature);
Integer senderId = senderDetails.getId();

Update sender signature.

SignatureToCreate signature = new SignatureToCreate();
signature.setName("Matt Smith");

// update sender signature
SignatureDetails senderDetails = client.setSenderSignature(senderId, signature);

Delete existing sender signature.

// delete sender signature
String response = client.deleteSenderSignature(senderId);