Skip to content

Cosmo/azure_communication_email

Repository files navigation

Azure Communication Email

Azure Communication Email is an Action Mailer delivery method for Ruby on Rails using the Azure Email Communications Service.

Installation

Install the gem and add to your application's Gemfile by executing:

bundle add azure_communication_email

Or add it manually to your Gemfile:

gem "azure_communication_email"

Usage

To send emails using Azure Communication Services, configure Action Mailer with the :azure_communication_email delivery method and provide the necessary credentials.

# config/environments/production.rb

Rails.application.configure do
  config.action_mailer.delivery_method = :azure_communication_email
  config.action_mailer.azure_communication_email_settings = {
    endpoint:   ENV.fetch("ACS_EMAIL_ENDPOINT"), # e.g., "https://<RESOURCE_NAME>.communication.azure.com"
    access_key: ENV.fetch("ACS_EMAIL_ACCESS_KEY"),
  }
end

Then, you can use Action Mailer as usual:

class UserMailer < ApplicationMailer
  def welcome_email(user)
    @user = user
    mail(to: @user.email, from: "donotreply@<yourdomain>.com", subject: "Hello World!")
  end
end

Links

Contributing

Bug reports and pull requests are welcome.

License

The gem is available as open source under the terms of the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors