-
Notifications
You must be signed in to change notification settings - Fork 70
Getting Started
Getting started with Postmark is very easy. In order to start using the full potential of Postmark Ruby Gem, you will need to:
- Signup for a new account
- Retrieve a Server API token, from one of the servers you created in your account
- Retrieve an Account API token (optional)
- Create a sender signature
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 email with Postmark is super easy, check out the following code example.
server_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
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.')
# => {: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"}
Some useful options are:
-
secure
(true
orfalse
): set to false to disable SSL connection. -
http_read_timeout
(positive number): limit HTTP read time ton
seconds. -
http_open_timeout
(positive number): limit HTTP open time ton
seconds. -
proxy_host
(string): proxy address to use. -
proxy_port
(positive number): proxy port to use. -
proxy_user
(string): proxy user. -
proxy_pass
(string): proxy password.
Please note that in in the code example above you need to retrieve server_token
from your account, and you need to change from address
to a verified signature, 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.
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