Skip to content

Getting Started

Igor Balos edited this page Oct 1, 2018 · 18 revisions

Getting started with Postmark is very easy. In order to start using full potential of Postmark API, you will need to:

Account API token is needed only for admins, for managing account details like domains, signatures, etc. To read more about tokens, check out our developer docs.

Sending your first email

Sending email with Postmark is super easy, check out the following code example.

client = Postmark::ApiClient.new(<server token>, http_open_timeout: 15)

client.deliver(from: '[email protected]',
               to: 'Leonard Hofstadter <[email protected]>',
               subject: 'Re: Come on, Sheldon. It will be fun.',
               text_body: 'That\'s what you said about the Green Lantern ' \
                          'movie. You were 114 minutes of wrong.')
# => {:to=>"Leonard Hofstadter <[email protected]>", :submitted_at=>"2013-05-09T02:45:16.2059023-04:00", :message_id=>"b2b268e3-6a70-xxxx-b897-49c9eb8b1d2e", :error_code=>0, :message=>"OK"}

Please note that in in the code example above you need to change to a server token from your account, and you need to change to a verified signature (from address), you created in your account.

Next, we will check out more advanced sending techniques and other API features. Check out our wiki pages sidebar for details.