SmtpLw

This is the ruby client for SMTP Locaweb product.

Installation

gem install smtp_lw

or add this line to Gemfile:

gem 'smtp_lw'

and run bundle install from your shell.

Usage

Authentication and Configuration

client = SmtpLw::Client.new(api_token: 'your api token from the panel')

or

SmtpLw.configure do |c|
  c.api_token = 'your api token'
  c.per_page = 50
end

# instantiate the client
client = SmtpLw::Client.new

You can also authenticate setting an environment variable

SMTP_LW_API_TOKEN='your api token'

and then use the client

client = SmtpLw::Client.new

Retrieving messages for a given period

client.list_messages('all', '2015-07-01', '2015-07-30')

You can pass options as specified in the API documentation:

client.list_messages('all', '2015-07-01', '2015-07-30', {page: 1, per: 50})

Sending a message

client.send_message('meeting tomorrow at 11', 'this is the body of my msg', '[email protected]',
'[email protected]')

Contributing

Please see CONTRIBUTING.md.

License

smtp_lw is Copyright © 2015-2016 Locaweb. It is free software, and may be redistributed under the terms specified in the LICENSE file.