-
Notifications
You must be signed in to change notification settings - Fork 71
Senders
tomek-ac edited this page Jun 22, 2022
·
8 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.
account_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client = Postmark::AccountApiClient.new(account_token, secure: true)
You can easily list and manage all sender signatures within your account.
client.get_signatures(offset: 0, count: 30)
# => [{:domain=>"example.com", :email_address=>"info@example.com", :reply_to_email_address=>"", :name=>"My Business", :confirmed=>true, :id=>2}]
Get a signatures enumerator:
client.signatures.map { |s| s[:id] }
# => [2]
client.signatures.lazy.select { |s| s[:domain] == 'example.com' }.first(2)
# => [{:domain=>"example.com", :email_address=>"info@example.com", :reply_to_email_address=>"", :name=>"My Business", :confirmed=>true, :id=>2}]
client.signatures.size # Lazily evaluated on Ruby 2.0.0 and above, not supported on legacy Ruby versions
# => 1
client.signatures.count # Calculates a count through iteration
# => 1
client.get_sender(1)
# => {:domain=>"example.com", :email_address=>"support@postmarkapp.com", ... }
client.create_sender(name: 'Postmark', from_email: 'support@postmarkapp.com')
# => {:domain=>"postmarkapp.com", :email_address=>"support@postmarkapp.com", :reply_to_email_address=>"", :name=>"Postmark", :confirmed=>false, ..., :id=>1}
client.update_sender(1, name: 'Postmarkapp')
# => {:domain=>"example.com", :email_address=>"support@postmarkapp.com", :reply_to_email_address=>"", :name=>"Postmarkapp", :confirmed=>false, ..., :id=>1}
Delete existing sender signature
client.delete_signature(1)
# => {:error_code=>0, :message=>"Signature support@postmarkapp.com removed."}
Re-send confirmation email for a signature:
client.resend_sender_confirmation(1)
# => {:error_code=>0, :message=>"Confirmation email for Sender Signature support@postmarkapp.com was re-sent."}
client.request_new_sender_dkim(1)
# => {:dkim_text_value => '', ...}
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Email sending
- Test email sending
- Bounces
- Templates
- Templates push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Tags
- Suppressions
- Data Removals
- Trigger Inbound Rules
- Parsing Inbound
- Using Postmark with Mail library
- Accessing Postmark Message ID
- Error Handling
- Integration Testing
- Troubleshooting
- Known issues and how to resolve them