EmailConfiguration » History » Version 49

Go MAEDA, 2017-08-21 05:13
Updated the URL of BitNami community site.

1 1 Cyber Sprocket
h1. Email Configuration
2 1 Cyber Sprocket
3 7 Mischa The Evil
{{>toc}}
4 7 Mischa The Evil
5 31 Miodrag Milic
6 1 Cyber Sprocket
h2. Configuration Directives
7 1 Cyber Sprocket
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 34 Anonymous
for detailed information.
10 1 Cyber Sprocket
11 1 Cyber Sprocket
h3. authentication
12 1 Cyber Sprocket
13 1 Cyber Sprocket
The type of authentication method expected by your service provider. 
14 1 Cyber Sprocket
15 1 Cyber Sprocket
Valid settings:
16 34 Anonymous
* @nil@ (or omit the key) for no authentication
17 34 Anonymous
* @:plain@
18 34 Anonymous
* @:login@
19 34 Anonymous
* @: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 1 Cyber Sprocket
h3. delivery_method
24 1 Cyber Sprocket
25 6 Eric Davis
The mail transport method to be used.
26 1 Cyber Sprocket
27 1 Cyber Sprocket
Valid settings:
28 34 Anonymous
* @:smtp@
29 34 Anonymous
* :@sendmail@
30 34 Anonymous
* @:async_smtp@
31 34 Anonymous
* @:async_sendmail@
32 1 Cyber Sprocket
33 6 Eric Davis
h4. Asynchronous delivery_methods
34 6 Eric Davis
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 23 Miodrag Milic
39 47 Toshi MARUYAMA
<pre><code class="yml">
40 23 Miodrag Milic
development:
41 23 Miodrag Milic
  email_delivery:
42 23 Miodrag Milic
    delivery_method: :async_smtp
43 23 Miodrag Milic
    async_smtp_settings:
44 23 Miodrag Milic
    ...
45 47 Toshi MARUYAMA
</code></pre>
46 23 Miodrag Milic
47 11 Etienne Massip
h2. Example configuration.yml Configurations
48 1 Cyber Sprocket
49 1 Cyber Sprocket
h3. Simple Login Authentication (default settings)
50 1 Cyber Sprocket
51 47 Toshi MARUYAMA
<pre><code class="yml">
52 1 Cyber Sprocket
# Outgoing email settings
53 1 Cyber Sprocket
54 1 Cyber Sprocket
production:
55 12 Ross Wilson
  email_delivery:
56 12 Ross Wilson
    delivery_method: :smtp
57 12 Ross Wilson
    smtp_settings:
58 12 Ross Wilson
      address: smtp.example.net
59 12 Ross Wilson
      port: 25
60 12 Ross Wilson
      domain: example.net
61 12 Ross Wilson
      authentication: :login
62 12 Ross Wilson
      user_name: redmine@example.net
63 12 Ross Wilson
      password: redmine
64 1 Cyber Sprocket
  
65 1 Cyber Sprocket
development:
66 12 Ross Wilson
  email_delivery:
67 12 Ross Wilson
    delivery_method: :smtp
68 12 Ross Wilson
    smtp_settings:
69 12 Ross Wilson
      address: 127.0.0.1
70 12 Ross Wilson
      port: 25
71 12 Ross Wilson
      domain: example.net
72 12 Ross Wilson
      authentication: :login
73 12 Ross Wilson
      user_name: redmine@example.net
74 12 Ross Wilson
      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 12 Ross Wilson
    delivery_method: :smtp
85 12 Ross Wilson
    smtp_settings:
86 12 Ross Wilson
      enable_starttls_auto: true
87 12 Ross Wilson
      address: "smtp.gmail.com" 
88 12 Ross Wilson
      port: '587'
89 12 Ross Wilson
      domain: "smtp.gmail.com" 
90 12 Ross Wilson
      authentication: :plain
91 1 Cyber Sprocket
      user_name: "your_email@gmail.com" 
92 1 Cyber Sprocket
      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 45 Maxim Krušina
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 46 Maxim Krušina
* Name: Redmine
99 46 Maxim Krušina
* 1. Allowed senders:
100 46 Maxim Krušina
** Only registered Apps users in my domains - in case You have created dedicated G Suite user for Redmine
101 46 Maxim Krušina
* 2. Authentication
102 46 Maxim Krušina
** [x] Only accept mail from the specified IP addresses - IP address of your Redmine server
103 46 Maxim Krušina
** [x] Require SMTP Authentication
104 46 Maxim Krušina
* 3. Encryption
105 46 Maxim Krušina
** [x] Require TLS encryption
106 46 Maxim Krušina
107 45 Maxim Krušina
And config can be really simple:
108 45 Maxim Krušina
109 47 Toshi MARUYAMA
<pre><code class="yml">
110 45 Maxim Krušina
production:
111 45 Maxim Krušina
  email_delivery:
112 45 Maxim Krušina
    delivery_method: :smtp
113 45 Maxim Krušina
    smtp_settings:
114 45 Maxim Krušina
      address: smtp-relay.gmail.com
115 45 Maxim Krušina
      port: 587
116 45 Maxim Krušina
      domain: smtp-relay.gmail.com
117 45 Maxim Krušina
      authentication: :plain
118 45 Maxim Krušina
      user_name: your_email@gmail.com
119 45 Maxim Krušina
      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 41 Pierre Maigne
126 47 Toshi MARUYAMA
<pre><code class="yml">
127 41 Pierre Maigne
production:
128 41 Pierre Maigne
  email_delivery:
129 41 Pierre Maigne
    delivery_method: :smtp
130 41 Pierre Maigne
    smtp_settings:
131 41 Pierre Maigne
      enable_starttls_auto: true
132 41 Pierre Maigne
      address: "smtp.office365.com"
133 41 Pierre Maigne
      port: '587'
134 41 Pierre Maigne
      domain: "your_domain.com"
135 41 Pierre Maigne
      authentication: :login
136 41 Pierre Maigne
      user_name: "email@your_domain.com"
137 41 Pierre Maigne
      password: "password"
138 47 Toshi MARUYAMA
</code></pre>
139 41 Pierre Maigne
140 8 Joël Lamotte
However, this will only work with "recent" enough ruby and rails versions (1.8.7 patchset 2xx and 2.3.5).
141 8 Joël Lamotte
(See #5814 )
142 8 Joël Lamotte
143 1 Cyber Sprocket
h3. No Authentication
144 1 Cyber Sprocket
145 34 Anonymous
Example for an SMTP service provider with no authentication.
146 1 Cyber Sprocket
147 47 Toshi MARUYAMA
<pre><code class="yml">
148 13 Ross Wilson
production:
149 13 Ross Wilson
  email_delivery:
150 13 Ross Wilson
    delivery_method: :smtp
151 13 Ross Wilson
    smtp_settings:
152 13 Ross Wilson
      address: smtp.knology.net
153 13 Ross Wilson
      port: 25
154 13 Ross Wilson
      domain: cybersprocket.com
155 47 Toshi MARUYAMA
</code></pre>
156 1 Cyber Sprocket
157 1 Cyber Sprocket
h3. Using sendmail command
158 5 Eric Davis
159 5 Eric Davis
Example for a unix system that uses the @/usr/sbin/sendmail@ command.
160 5 Eric Davis
161 47 Toshi MARUYAMA
<pre><code class="yml">
162 5 Eric Davis
production:
163 13 Ross Wilson
  email_delivery:
164 13 Ross Wilson
    delivery_method: :sendmail
165 47 Toshi MARUYAMA
</code></pre>
166 1 Cyber Sprocket
167 35 Jean-Baptiste Barth
h2. Troubleshooting
168 35 Jean-Baptiste Barth
169 35 Jean-Baptiste Barth
h3. Error: "hostname was not match with the server certificate"
170 35 Jean-Baptiste Barth
171 35 Jean-Baptiste Barth
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:
172 35 Jean-Baptiste Barth
173 48 Toshi MARUYAMA
<pre><code class="yml">
174 35 Jean-Baptiste Barth
    enable_starttls_auto: false
175 48 Toshi MARUYAMA
</code></pre>
176 35 Jean-Baptiste Barth
177 36 Richard Gomes
h3. Error: "Mail failure - no recipient addresses"
178 36 Richard Gomes
179 36 Richard Gomes
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.
180 36 Richard Gomes
181 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.
182 36 Richard Gomes
183 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:
184 36 Richard Gomes
185 47 Toshi MARUYAMA
<pre><code class="yml">
186 36 Richard Gomes
# default configuration options for all environments
187 36 Richard Gomes
default:
188 36 Richard Gomes
  email_delivery:    
189 36 Richard Gomes
    delivery_method: :sendmail
190 36 Richard Gomes
    sendmail_settings:
191 36 Richard Gomes
      arguments: "-i" 
192 47 Toshi MARUYAMA
</code></pre>
193 36 Richard Gomes
194 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.
195 38 Richard Gomes
196 43 hongbo yang
h3. Error: "Timeout:Error" due to SSL SMTP server connection
197 43 hongbo yang
198 1 Cyber Sprocket
add an ssl option to the configuration.yml #17239
199 43 hongbo yang
200 47 Toshi MARUYAMA
<pre><code class="yml">
201 42 hongbo yang
default:
202 42 hongbo yang
  # Outgoing emails configuration (see examples above)
203 42 hongbo yang
  email_delivery:
204 42 hongbo yang
    delivery_method: :smtp
205 42 hongbo yang
  smtp_settings:
206 42 hongbo yang
    address: smtp.domain.com
207 42 hongbo yang
    port: 465
208 42 hongbo yang
    ssl: true
209 42 hongbo yang
    enable_starttls_auto: true
210 42 hongbo yang
    domain: domain.com
211 42 hongbo yang
    authentication: :login
212 42 hongbo yang
    user_name: redmine@domain.com
213 42 hongbo yang
    password: xxxx
214 47 Toshi MARUYAMA
</code></pre>
215 42 hongbo yang
216 7 Mischa The Evil
h2. More information
217 5 Eric Davis
218 5 Eric Davis
* "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration