mailgunner

3.4.0last stable release 2 months ago
Complexity Score
Low
Open Issues
0
Dependent Projects
0
Weekly Downloadsglobal
28

License

  • LGPL-3.0

    Downloads

    Readme

    mailgunner

    Ruby client for the Mailgun API.

    Installation

    $ gem install mailgunner
    

    Usage

    require 'mailgunner'
    
    Mailgunner.configure do |config|
      config.domain = 'samples.mailgun.org'
      config.api_key = 'key-3ax6xnjp29jd6fds4gc373sgvjxteol0'
    end
    
    mailgun = Mailgunner::Client.new
    
    mailgun.get_domains.items.each do |item|
      puts "#{item.id} #{item.name}"
    end
    

    Storing the API key

    Best practice for credentials is to store them in the environment. Mailgunner::Client defaults to extracting the domain and api_key values it needs from the MAILGUN_API_KEY and MAILGUN_SMTP_LOGIN environment variables—these will exist if you are using Mailgun on Heroku, or you can set them manually.

    ActionMailer integration

    Mailgunner integrates with ActionMailer. If you are using Rails, you can use Mailgunner to send mail via Mailgun by adding the following line to config/environments/production.rb:

    config.action_mailer.delivery_method = :mailgun
    

    If for some reason you can’t set the required ENV variables, you can configure Mailgunner through ActionMailer settings:

    config.action_mailer.mailgun_settings = {
      domain: 'test.com',
      api_key: 'your-api-key'
    }
    

    Outside of Rails you can set ActionMailer::Base.delivery_method directly.

    Specifying the region

    Mailgun offers both a US and EU region to send your email from. Mailgunner uses the US region by default. If you wish to use the EU region set the api_host config option like so:

    Mailgunner.configure do |config|
      config.api_host = 'api.eu.mailgun.net'
    end
    

    Dependencies

    No runtime dependency information found for this package.

    CVE IssuesActive
    0
    Scorecards Score
    No Data
    Test Coverage
    No Data
    Follows Semver
    Yes
    Github Stars
    26
    Dependenciestotal
    0
    DependenciesOutdated
    0
    DependenciesDeprecated
    0
    Threat Modelling
    No
    Repo Audits
    No

    Learn how to distribute mailgunner in your own private RubyGems registry

    gem install mailgunner
    Processing...
    Done

    20 Releases

    RubyGems on Cloudsmith

    Getting started with RubyGems on Cloudsmith is fast and easy.