debian-mirror-gitlab/vendor/gems/mail-smtp_pool
2022-08-27 11:52:29 +05:30
..
lib/mail New upstream version 13.12.3+ds1 2021-06-08 01:23:25 +05:30
spec New upstream version 13.12.3+ds1 2021-06-08 01:23:25 +05:30
.gitignore New upstream version 13.11.2+ds1 2021-04-29 21:17:54 +05:30
.gitlab-ci.yml New upstream version 15.3.1+ds1 2022-08-27 11:52:29 +05:30
Gemfile New upstream version 13.11.2+ds1 2021-04-29 21:17:54 +05:30
LICENSE New upstream version 13.11.2+ds1 2021-04-29 21:17:54 +05:30
mail-smtp_pool.gemspec New upstream version 13.11.2+ds1 2021-04-29 21:17:54 +05:30
README.md New upstream version 13.11.2+ds1 2021-04-29 21:17:54 +05:30

Mail::SMTPPool

This gem is an extension to Mail that allows delivery of emails using an SMTP connection pool

Installation

Add this line to your application's Gemfile:

gem 'mail-smtp_pool'

And then execute:

bundle

Or install it yourself as:

gem install mail-smtp_pool

Usage with ActionMailer

# config/environments/development.rb

Rails.application.configure do
  ...

  ActionMailer::Base.add_delivery_method :smtp_pool, Mail::SMTPPool

  config.action_mailer.perform_deliveries = true
  config.action_mailer.smtp_pool_settings = {
    pool: Mail::SMTPPool.create_pool(
      pool_size:            5,
      pool_timeout:         5,
      address:              'smtp.gmail.com',
      port:                 587,
      domain:               'example.com',
      user_name:            '<username>',
      password:             '<password>',
      authentication:       'plain',
      enable_starttls_auto: true
    )
  }
end

Configuration options:

  • pool_size - The maximum number of SMTP connections in the pool. Connections are created lazily as needed.
  • pool_timeout - The number of seconds to wait for a connection in the pool to be available. A Timeout::Error exception is raised when this is exceeded.

This also accepts all options supported by Mail::SMTP. See https://www.rubydoc.info/gems/mail/2.6.1/Mail/SMTP for more information.