Welcome to mirror list, hosted at ThFree Co, Russian Federation.

README.md « mail-smtp_pool « gems « vendor - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bdb2be97663a9f8316eb54a411dc3ffb98152254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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:

```ruby
gem 'mail-smtp_pool'
```

And then execute:

```shell
bundle
```

Or install it yourself as:

```shell
gem install mail-smtp_pool
```

## Usage with ActionMailer

```ruby
# 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.