Mailrelay, email marketing

Using Mailrelay API with Ruby

Published by Mailrelay on June 28, 2012

If you’re using Ruby you can use our recently launched Mailrelay gem. Available for free at Rubygems as well as in our GitHub repository.

This gem will allow you to access our API functions in a simple way. To install it, run:

1
gem install mailrelay
gem install mailrelay

After that, usage is pretty simple. If we want to add a subscriber to our Mailrelay account, for example, we could use the following script:

1
2
3
4
5
6
7
8
9
</p>
<p>require 'rubygems'</p>
<p>require 'mailrelay'</p>
<p># Set your hostname and api key here</p>
<p>hostname = 'your_hostname'</p>
<p>api_key = 'your_api_key'</p>
<p>api = Mailrelay::API.new hostname, api_key</p>
<p>api.addSubscriber :email => "email@example.org", :name => "Name"</p>
<p>
</p>
<p>require 'rubygems'</p>
<p>require 'mailrelay'</p>
<p># Set your hostname and api key here</p>
<p>hostname = 'your_hostname'</p>
<p>api_key = 'your_api_key'</p>
<p>api = Mailrelay::API.new hostname, api_key</p>
<p>api.addSubscriber :email => "email@example.org", :name => "Name"</p>
<p>

There are other examples available in GitHub and you can always check our API documentation for more info. All functions available in API can be used with our gem.

We hope this is useful for all Ruby developers whom would like to manage your Mailrelay accounts using the API.

Subscribe to Mailrelay's newsletter

Name:
Email:
 

Comments

Leave a comment

Your email address will not be published. Required fields are marked *

Subscribe to Mailrelay's newsletter