Project

General

Profile

EmailConfiguration » History » Version 51

Go MAEDA, 2017-12-16 08:09
Removed single quotation marks from port numbers in configuration.yml.

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
Valid settings:
28 34 Anonymous
* @:smtp@
29
* :@sendmail@
30
* @:async_smtp@
31
* @:async_sendmail@
32 1 Cyber Sprocket
33 6 Eric Davis
h4. Asynchronous delivery_methods
34
35 49 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 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 default value, see also #11376 for more information) .
36 1 Cyber Sprocket
37 23 Miodrag Milic
With this delivery method, smtp configuration is specified using @async_smtp_settings@ keyword:
38
39 47 Toshi MARUYAMA
<pre><code class="yml">
40 23 Miodrag Milic
development:
41
  email_delivery:
42
    delivery_method: :async_smtp
43
    async_smtp_settings:
44
    ...
45 47 Toshi MARUYAMA
</code></pre>
46 23 Miodrag Milic
47 11 Etienne Massip
h2. Example configuration.yml Configurations
48 1 Cyber Sprocket
49
h3. Simple Login Authentication (default settings)
50
51 47 Toshi MARUYAMA
<pre><code class="yml">
52 1 Cyber Sprocket
# Outgoing email settings
53
54
production:
55 12 Ross Wilson
  email_delivery:
56
    delivery_method: :smtp
57
    smtp_settings:
58
      address: smtp.example.net
59
      port: 25
60
      domain: example.net
61
      authentication: :login
62
      user_name: redmine@example.net
63
      password: redmine
64 1 Cyber Sprocket
  
65
development:
66 12 Ross Wilson
  email_delivery:
67
    delivery_method: :smtp
68
    smtp_settings:
69
      address: 127.0.0.1
70
      port: 25
71
      domain: example.net
72
      authentication: :login
73
      user_name: redmine@example.net
74
      password: redmine
75 47 Toshi MARUYAMA
</code></pre>
76 1 Cyber Sprocket
77 44 Holger Just
h3. GMail, Google Apps
78 1 Cyber Sprocket
79 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:
80 8 Joël Lamotte
81 47 Toshi MARUYAMA
<pre><code class="yml">
82 8 Joël Lamotte
production:
83 12 Ross Wilson
  email_delivery:
84
    delivery_method: :smtp
85
    smtp_settings:
86
      enable_starttls_auto: true
87
      address: "smtp.gmail.com" 
88 51 Go MAEDA
      port: 587
89 12 Ross Wilson
      domain: "smtp.gmail.com" 
90
      authentication: :plain
91 1 Cyber Sprocket
      user_name: "your_email@gmail.com" 
92
      password: "your_password" 
93 47 Toshi MARUYAMA
</code></pre>
94 44 Holger Just
95 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.
96
More information and detailed guide how to enable SMTP relay is here: https://support.google.com/a/answer/2956491
97 46 Maxim Krušina
When configuring SMTP relay service use something like this:
98
* Name: Redmine
99
* 1. Allowed senders:
100
** Only registered Apps users in my domains - in case You have created dedicated G Suite user for Redmine
101
* 2. Authentication
102
** [x] Only accept mail from the specified IP addresses - IP address of your Redmine server
103
** [x] Require SMTP Authentication
104
* 3. Encryption
105
** [x] Require TLS encryption
106
107 45 Maxim Krušina
And config can be really simple:
108
109 47 Toshi MARUYAMA
<pre><code class="yml">
110 45 Maxim Krušina
production:
111
  email_delivery:
112
    delivery_method: :smtp
113
    smtp_settings:
114
      address: smtp-relay.gmail.com
115
      port: 587
116
      domain: smtp-relay.gmail.com
117
      authentication: :plain
118
      user_name: your_email@gmail.com
119
      password: your_password
120 47 Toshi MARUYAMA
</code></pre>
121 45 Maxim Krušina
122 44 Holger Just
h3. Office 365, Exchange Online
123 8 Joël Lamotte
124 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.
125
126 47 Toshi MARUYAMA
<pre><code class="yml">
127 41 Pierre Maigne
production:
128
  email_delivery:
129
    delivery_method: :smtp
130
    smtp_settings:
131
      enable_starttls_auto: true
132
      address: "smtp.office365.com"
133 51 Go MAEDA
      port: 587
134 41 Pierre Maigne
      domain: "your_domain.com"
135
      authentication: :login
136
      user_name: "email@your_domain.com"
137
      password: "password"
138 47 Toshi MARUYAMA
</code></pre>
139 41 Pierre Maigne
140 8 Joël Lamotte
141 1 Cyber Sprocket
h3. No Authentication
142
143 34 Anonymous
Example for an SMTP service provider with no authentication.
144 1 Cyber Sprocket
145 47 Toshi MARUYAMA
<pre><code class="yml">
146 13 Ross Wilson
production:
147
  email_delivery:
148
    delivery_method: :smtp
149
    smtp_settings:
150
      address: smtp.knology.net
151
      port: 25
152
      domain: cybersprocket.com
153 47 Toshi MARUYAMA
</code></pre>
154 1 Cyber Sprocket
155
h3. Using sendmail command
156 5 Eric Davis
157
Example for a unix system that uses the @/usr/sbin/sendmail@ command.
158
159 47 Toshi MARUYAMA
<pre><code class="yml">
160 5 Eric Davis
production:
161 13 Ross Wilson
  email_delivery:
162
    delivery_method: :sendmail
163 47 Toshi MARUYAMA
</code></pre>
164 1 Cyber Sprocket
165 35 Jean-Baptiste Barth
h2. Troubleshooting
166
167
h3. Error: "hostname was not match with the server certificate"
168
169
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:
170
171 48 Toshi MARUYAMA
<pre><code class="yml">
172 35 Jean-Baptiste Barth
    enable_starttls_auto: false
173 48 Toshi MARUYAMA
</code></pre>
174 35 Jean-Baptiste Barth
175 36 Richard Gomes
h3. Error: "Mail failure - no recipient addresses"
176
177
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.
178
179 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.
180 36 Richard Gomes
181 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:
182 36 Richard Gomes
183 47 Toshi MARUYAMA
<pre><code class="yml">
184 36 Richard Gomes
# default configuration options for all environments
185
default:
186
  email_delivery:    
187
    delivery_method: :sendmail
188
    sendmail_settings:
189
      arguments: "-i" 
190 47 Toshi MARUYAMA
</code></pre>
191 36 Richard Gomes
192 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.
193 38 Richard Gomes
194 43 hongbo yang
h3. Error: "Timeout:Error" due to SSL SMTP server connection
195
196 1 Cyber Sprocket
add an ssl option to the configuration.yml #17239
197 43 hongbo yang
198 47 Toshi MARUYAMA
<pre><code class="yml">
199 42 hongbo yang
default:
200
  # Outgoing emails configuration (see examples above)
201
  email_delivery:
202
    delivery_method: :smtp
203
  smtp_settings:
204
    address: smtp.domain.com
205
    port: 465
206
    ssl: true
207
    enable_starttls_auto: true
208
    domain: domain.com
209
    authentication: :login
210
    user_name: redmine@domain.com
211
    password: xxxx
212 47 Toshi MARUYAMA
</code></pre>
213 42 hongbo yang
214 7 Mischa The Evil
h2. More information
215 5 Eric Davis
216
* "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration