Project

General

Profile

EmailConfiguration » History » Version 54

Ben Blanco, 2020-03-23 15:47

1 1 Cyber Sprocket
h1. Email Configuration
2
3 7 Mischa The Evil
{{>toc}}
4
5 31 Miodrag Milic
6 1 Cyber Sprocket
h2. Configuration Directives
7
8 34 Anonymous
This page is a work in progress, the following configuration directives are only a partial list. Please consult "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
9
for detailed information.
10 1 Cyber Sprocket
11
h3. authentication
12
13
The type of authentication method expected by your service provider. 
14
15
Valid settings:
16 34 Anonymous
* @nil@ (or omit the key) for no authentication
17
* @:plain@
18
* @:login@
19
* @:cram_md5@
20 1 Cyber Sprocket
21 34 Anonymous
(note: if you set this to @nil@ or omit it, you must not include the @user_name@ and @password@ settings)
22 1 Cyber Sprocket
23
h3. delivery_method
24
25 6 Eric Davis
The mail transport method to be used.
26 1 Cyber Sprocket
27 54 Ben Blanco
Valid settings (=< Redmine v3.x):
28 34 Anonymous
* @:smtp@
29
* :@sendmail@
30
* @:async_smtp@
31 1 Cyber Sprocket
* @:async_sendmail@
32 54 Ben Blanco
33
Valid settings (>= Redmine v4.x; cf. #30068):
34
* @:smtp@
35
* :@sendmail@
36 1 Cyber Sprocket
37 6 Eric Davis
h4. Asynchronous delivery_methods
38
39 52 Go MAEDA
The @:async_smtp@ and @:async_sendmail@ use asynchronous sends, which means Redmine does not wait for the email to be sent to display the next page.  See "Asynchronous Email Delivery":http://redmineblog.com/articles/asynchronous-email-delivery/ for more details. Some SMTP servers have delay period before processing takes place as an anti-spam feature, during which time synchronous method will block Redmine ("10 seconds":https://community.bitnami.com/t/updating-an-issue-in-redmine-takes-10-seconds/4421 could be a default value, see also #11376 for more information).
40 1 Cyber Sprocket
41 52 Go MAEDA
With this delivery method, smtp configuration is specified using @async_smtp_settings@ keyword instead of @smtp_settings@ keyword:
42 23 Miodrag Milic
43 47 Toshi MARUYAMA
<pre><code class="yml">
44 23 Miodrag Milic
development:
45 1 Cyber Sprocket
  email_delivery:
46
    delivery_method: :async_smtp
47 52 Go MAEDA
    async_smtp_settings:  # Don't use "smtp_settings"
48
      address: ...
49
      port: ...
50
      ...
51 47 Toshi MARUYAMA
</code></pre>
52 23 Miodrag Milic
53 11 Etienne Massip
h2. Example configuration.yml Configurations
54 1 Cyber Sprocket
55
h3. Simple Login Authentication (default settings)
56
57 47 Toshi MARUYAMA
<pre><code class="yml">
58 1 Cyber Sprocket
# Outgoing email settings
59
60
production:
61 12 Ross Wilson
  email_delivery:
62
    delivery_method: :smtp
63
    smtp_settings:
64
      address: smtp.example.net
65
      port: 25
66
      domain: example.net
67
      authentication: :login
68
      user_name: redmine@example.net
69
      password: redmine
70 1 Cyber Sprocket
  
71
development:
72 12 Ross Wilson
  email_delivery:
73
    delivery_method: :smtp
74
    smtp_settings:
75
      address: 127.0.0.1
76
      port: 25
77
      domain: example.net
78
      authentication: :login
79
      user_name: redmine@example.net
80
      password: redmine
81 47 Toshi MARUYAMA
</code></pre>
82 1 Cyber Sprocket
83 44 Holger Just
h3. GMail, Google Apps
84 1 Cyber Sprocket
85 44 Holger Just
If you want to use GMail/Google Apps and other TLS-requiring SMTP servers, you'll have to add some TLS-related settings:
86 8 Joël Lamotte
87 47 Toshi MARUYAMA
<pre><code class="yml">
88 8 Joël Lamotte
production:
89 12 Ross Wilson
  email_delivery:
90
    delivery_method: :smtp
91
    smtp_settings:
92
      enable_starttls_auto: true
93
      address: "smtp.gmail.com" 
94 51 Go MAEDA
      port: 587
95 12 Ross Wilson
      domain: "smtp.gmail.com" 
96
      authentication: :plain
97 1 Cyber Sprocket
      user_name: "your_email@gmail.com" 
98
      password: "your_password" 
99 47 Toshi MARUYAMA
</code></pre>
100 44 Holger Just
101 45 Maxim Krušina
When sending from G Suite (formerly Google Apps), it's good to use *SMTP relay* which has much larger sending limits.
102
More information and detailed guide how to enable SMTP relay is here: https://support.google.com/a/answer/2956491
103 46 Maxim Krušina
When configuring SMTP relay service use something like this:
104
* Name: Redmine
105
* 1. Allowed senders:
106
** Only registered Apps users in my domains - in case You have created dedicated G Suite user for Redmine
107
* 2. Authentication
108
** [x] Only accept mail from the specified IP addresses - IP address of your Redmine server
109
** [x] Require SMTP Authentication
110
* 3. Encryption
111
** [x] Require TLS encryption
112
113 45 Maxim Krušina
And config can be really simple:
114
115 47 Toshi MARUYAMA
<pre><code class="yml">
116 45 Maxim Krušina
production:
117
  email_delivery:
118
    delivery_method: :smtp
119
    smtp_settings:
120
      address: smtp-relay.gmail.com
121
      port: 587
122
      domain: smtp-relay.gmail.com
123
      authentication: :plain
124
      user_name: your_email@gmail.com
125
      password: your_password
126 47 Toshi MARUYAMA
</code></pre>
127 45 Maxim Krušina
128 44 Holger Just
h3. Office 365, Exchange Online
129 8 Joël Lamotte
130 41 Pierre Maigne
Here is an example for Office 365 users (Exchange online). The sender must have an account, or if you want to send from a shared mailbox, the account below must have authorization to "Send As" the sender which is defined in Redmine email notifications settings.
131
132 47 Toshi MARUYAMA
<pre><code class="yml">
133 41 Pierre Maigne
production:
134
  email_delivery:
135
    delivery_method: :smtp
136
    smtp_settings:
137
      enable_starttls_auto: true
138
      address: "smtp.office365.com"
139 51 Go MAEDA
      port: 587
140 41 Pierre Maigne
      domain: "your_domain.com"
141
      authentication: :login
142
      user_name: "email@your_domain.com"
143
      password: "password"
144 47 Toshi MARUYAMA
</code></pre>
145 41 Pierre Maigne
146 8 Joël Lamotte
147 1 Cyber Sprocket
h3. No Authentication
148
149 34 Anonymous
Example for an SMTP service provider with no authentication.
150 1 Cyber Sprocket
151 47 Toshi MARUYAMA
<pre><code class="yml">
152 13 Ross Wilson
production:
153
  email_delivery:
154
    delivery_method: :smtp
155
    smtp_settings:
156
      address: smtp.knology.net
157
      port: 25
158
      domain: cybersprocket.com
159 47 Toshi MARUYAMA
</code></pre>
160 1 Cyber Sprocket
161
h3. Using sendmail command
162 5 Eric Davis
163
Example for a unix system that uses the @/usr/sbin/sendmail@ command.
164
165 47 Toshi MARUYAMA
<pre><code class="yml">
166 5 Eric Davis
production:
167 13 Ross Wilson
  email_delivery:
168
    delivery_method: :sendmail
169 47 Toshi MARUYAMA
</code></pre>
170 1 Cyber Sprocket
171 35 Jean-Baptiste Barth
h2. Troubleshooting
172
173
h3. Error: "hostname was not match with the server certificate"
174
175
If you get this error, there's probably a problem verifying the SSL certificate of your smtp relay. As a temporary fix, you can set this option in the appropriate "email_delivery" section:
176
177 48 Toshi MARUYAMA
<pre><code class="yml">
178 35 Jean-Baptiste Barth
    enable_starttls_auto: false
179 48 Toshi MARUYAMA
</code></pre>
180 35 Jean-Baptiste Barth
181 53 Lloyd Su
If you have to enable starttls and just want to bypass the certificate verification, you can add following option in the appropriate "email_delivery" section:
182
183
<pre><code class="yml">
184
    openssl_verify_mode: "NONE"
185
</code></pre>
186
187 36 Richard Gomes
h3. Error: "Mail failure - no recipient addresses"
188
189
When this error happens, the notification is not delivered to the destination address. Instead, you will probably receive a rejection message on your sender address, where you can see the header of the message sent, containing "From:" fields but not containing any "To:" fields.
190
191 39 Richard Gomes
This error is common on *Debian* boxes, due to the way _exim4_ is configured by default, which is @"-i -t"@. This configuration tells _exim4_ that the destination address is inside the header of the message. Instead, we need to configure _exim4_ so that the destination address will be retrieved from the command line.
192 36 Richard Gomes
193 37 Richard Gomes
The solution consists on editing your _config/configuration.yml_ and making sure you define @arguments@ containing the string @"-i"@, as shown below:
194 36 Richard Gomes
195 47 Toshi MARUYAMA
<pre><code class="yml">
196 36 Richard Gomes
# default configuration options for all environments
197
default:
198
  email_delivery:    
199
    delivery_method: :sendmail
200
    sendmail_settings:
201
      arguments: "-i" 
202 47 Toshi MARUYAMA
</code></pre>
203 36 Richard Gomes
204 40 Richard Gomes
The example above employs @:sendmail@ method, which employs @sendmail_settings@. In case you are using @:smtp@ or @:async_smtp@ methods, try @smtp_settings@ instead.
205 38 Richard Gomes
206 43 hongbo yang
h3. Error: "Timeout:Error" due to SSL SMTP server connection
207
208 1 Cyber Sprocket
add an ssl option to the configuration.yml #17239
209 43 hongbo yang
210 47 Toshi MARUYAMA
<pre><code class="yml">
211 42 hongbo yang
default:
212
  # Outgoing emails configuration (see examples above)
213
  email_delivery:
214
    delivery_method: :smtp
215
  smtp_settings:
216
    address: smtp.domain.com
217
    port: 465
218
    ssl: true
219
    enable_starttls_auto: true
220
    domain: domain.com
221
    authentication: :login
222
    user_name: redmine@domain.com
223
    password: xxxx
224 47 Toshi MARUYAMA
</code></pre>
225 42 hongbo yang
226 7 Mischa The Evil
h2. More information
227 5 Eric Davis
228
* "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration