https://github.com/postalserver/postal-mailgem
A gem to use Postal as a delivery method with the Ruby Mail gem
https://github.com/postalserver/postal-mailgem
Last synced: 3 months ago
JSON representation
A gem to use Postal as a delivery method with the Ruby Mail gem
- Host: GitHub
- URL: https://github.com/postalserver/postal-mailgem
- Owner: postalserver
- Created: 2017-04-20T15:20:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-16T12:23:01.000Z (over 8 years ago)
- Last Synced: 2025-04-08T19:46:47.483Z (9 months ago)
- Language: Ruby
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Postal for the Mail Gem
This allows you to easily deliver messages through Postal using the Ruby `mail` gem.
## Installation
Add the gems to your Gemfile and run `bundle install`.
```ruby
gem 'mail'
gem 'postal-mailgem'
```
## Configuraton
You can set the delivery method globally to use Postal.
```ruby
Mail.defaults do
delivery_method :postal, :host => 'https://postal.yourdomain.com', :server_key => 'xxx'
end
```
Or, you can configure it on a per message basis:
```ruby
message = Mail.new
message.to "invalid@pat.infra.atech.io"
message.from "blah@test.postal.io"
message.body "Hello there!"
message.delivery_method :postal, :host => 'https://postal.yourdomain.com', :server_key => 'xxx'
message.deliver
```
You don't need to specify a `server_key` or `host` if you have set the `POSTAL_KEY` and `POSTAL_HOST` environment variables.