Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
OhMySMTP lets you send transactional emails from your app over an easy to use API.
The OhMySMTP Rails Gem is a plug in for ActionMailer to send emails via OhMySMTP to make sending emails from Rails apps super simple.
New in 0.3.0: The ability to consume inbound emails from OhMySMTP via ActionMailbox
Once installed and configured, continue to send emails using ActionMailer and receive emails with ActionMailbox like normal.
You will need an OhMySMTP account with a verified domain and organization with an active plan.
Set up an account at OhMySMTP and complete the Onboarding steps
Add this line to your application's Gemfile:
gem 'ohmysmtp-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ohmysmtp-rails
First you will need to retrieve your API token for your sending domain from OhMySMTP. You can find it under Organization -> Domain -> API Tokens.
Use the encrypted secret management to save your API Token to config/credentials.yml.enc
by running the following:
rails secret
rails credentials:edit
Then add your token:
ohmysmtp_api_token: "TOKEN_GOES_HERE"
Set OhMySMTP as your mail delivery method in config/application.rb
:
config.action_mailer.delivery_method = :ohmysmtp
config.action_mailer.ohmysmtp_settings = { api_token: Rails.application.credentials.ohmysmtp_api_token }
You can tag messages and filter them later in the OhMySMTP UI. To do this, pass the tags as a header by adding a tag variable to your mail
method call.
class TestMailer < ApplicationMailer
default from: 'notifications@example.com',
to: 'fake@sdfasdfsdaf.com'
def single_tag
mail(
tags: 'test tag' # One tag
)
end
def multi_tag
mail(
tags: "['test tag', 'another-tag']" # Multiple tags
)
end
end
Note that this should always be a string, even if using an array of multiple tags.
To add a List-Unsubscribe header, pass a list_unsubscribe
string to the mail
function:
class TestMailer < ApplicationMailer
default from: 'notifications@example.com',
to: 'fake@sdfasdfsdaf.com'
def list_unsub_header
mail(
list_unsubscribe: 'https://listunsublink.com'
)
end
end
As of v0.3.0, this Gem supports handling Inbound Emails (see https://docs.ohmysmtp.com/guide/inbound/ for more details) via ActionMailbox. To set this up:
config/environments/production.rb
config.action_mailbox.ingress = :ohmysmtp
bin/rails credentials:edit
to add the password to your application's encrypted credentials under action_mailbox.ingress_password
, where Action Mailbox will automatically find it:action_mailbox:
ingress_password: ...
Alternatively, provide the password in the RAILS_INBOUND_EMAIL_PASSWORD
environment variable.
/rails/action_mailbox/ohmysmtp/inbound_emails
with the username actionmailbox
and the password you previously generated. If your application lived at https://example.com
you would configure your OhMySMTP inbound endpoint URL with the following fully-qualified URL:https://actionmailbox:PASSWORD@example.com/rails/action_mailbox/ohmysmtp/inbound_emails
That's it! Emails should start flowing into your app just like magic.
For support please check the OhMySMTP Documentation or contact us at support@ohmysmtp.com
Please ensure to add a test for any change you make. To run the tests:
bin/test
Pull requests always welcome
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that ohmysmtp-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.