EmailConfiguration » History » Version 57
Christian Haeberli, 2024-01-10 12:00
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 | 56 | sceox x | delivery_method: :async_smtp |
46 | async_smtp_settings: # Don't use "smtp_settings" |
||
47 | address: ... |
||
48 | port: ... |
||
49 | ... |
||
50 | 47 | Toshi MARUYAMA | </code></pre> |
51 | 23 | Miodrag Milic | |
52 | 55 | Liane Hampe | > *Please note:* Since Redmine 4.0 asynchronous email sending is removed in favour of Rails ActiveJob module which sends emails asynchronously.See https://www.redmine.org/projects/redmine/repository/entry/tags/4.0.0/lib/redmine/configuration.rb#L53 for more details. |
53 | |||
54 | 11 | Etienne Massip | h2. Example configuration.yml Configurations |
55 | 1 | Cyber Sprocket | |
56 | h3. Simple Login Authentication (default settings) |
||
57 | |||
58 | <pre><code class="yml"> |
||
59 | # Outgoing email settings |
||
60 | 12 | Ross Wilson | |
61 | production: |
||
62 | 56 | sceox x | 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 | 12 | Ross Wilson | |
71 | development: |
||
72 | 56 | sceox x | delivery_method: :smtp |
73 | smtp_settings: |
||
74 | address: 127.0.0.1 |
||
75 | port: 25 |
||
76 | domain: example.net |
||
77 | authentication: :login |
||
78 | user_name: redmine@example.net |
||
79 | password: redmine |
||
80 | 1 | Cyber Sprocket | </code></pre> |
81 | |||
82 | h3. GMail, Google Apps |
||
83 | |||
84 | If you want to use GMail/Google Apps and other TLS-requiring SMTP servers, you'll have to add some TLS-related settings: |
||
85 | 8 | Joël Lamotte | |
86 | 12 | Ross Wilson | <pre><code class="yml"> |
87 | production: |
||
88 | 56 | sceox x | delivery_method: :smtp |
89 | smtp_settings: |
||
90 | enable_starttls_auto: true |
||
91 | address: "smtp.gmail.com" |
||
92 | port: 587 |
||
93 | domain: "smtp.gmail.com" |
||
94 | authentication: :plain |
||
95 | user_name: "your_email@gmail.com" |
||
96 | password: "your_password" |
||
97 | 1 | Cyber Sprocket | </code></pre> |
98 | |||
99 | When sending from G Suite (formerly Google Apps), it's good to use *SMTP relay* which has much larger sending limits. |
||
100 | More information and detailed guide how to enable SMTP relay is here: https://support.google.com/a/answer/2956491 |
||
101 | 44 | Holger Just | When configuring SMTP relay service use something like this: |
102 | 46 | Maxim Krušina | * Name: Redmine |
103 | 1 | Cyber Sprocket | * 1. Allowed senders: |
104 | 46 | Maxim Krušina | ** Only registered Apps users in my domains - in case You have created dedicated G Suite user for Redmine |
105 | * 2. Authentication |
||
106 | ** [x] Only accept mail from the specified IP addresses - IP address of your Redmine server |
||
107 | ** [x] Require SMTP Authentication |
||
108 | * 3. Encryption |
||
109 | 45 | Maxim Krušina | ** [x] Require TLS encryption |
110 | 47 | Toshi MARUYAMA | |
111 | 45 | Maxim Krušina | And config can be really simple: |
112 | |||
113 | <pre><code class="yml"> |
||
114 | 1 | Cyber Sprocket | production: |
115 | 56 | sceox x | delivery_method: :smtp |
116 | smtp_settings: |
||
117 | address: smtp-relay.gmail.com |
||
118 | port: 587 |
||
119 | domain: smtp-relay.gmail.com |
||
120 | authentication: :plain |
||
121 | user_name: your_email@gmail.com |
||
122 | password: your_password |
||
123 | 8 | Joël Lamotte | </code></pre> |
124 | 41 | Pierre Maigne | |
125 | h3. Office 365, Exchange Online |
||
126 | 47 | Toshi MARUYAMA | |
127 | 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. |
128 | 1 | Cyber Sprocket | |
129 | <pre><code class="yml"> |
||
130 | production: |
||
131 | 56 | sceox x | delivery_method: :smtp |
132 | smtp_settings: |
||
133 | enable_starttls_auto: true |
||
134 | address: "smtp.office365.com" |
||
135 | port: 587 |
||
136 | domain: "your_domain.com" |
||
137 | authentication: :login |
||
138 | user_name: "email@your_domain.com" |
||
139 | password: "password" |
||
140 | 1 | Cyber Sprocket | </code></pre> |
141 | |||
142 | 57 | Christian Haeberli | Note: the O365 SMTP server limits the number of parallel connections to three. Therefore, the number of sender thread needs to be limited as well. See #31957 for details. |
143 | 34 | Anonymous | |
144 | 1 | Cyber Sprocket | h3. No Authentication |
145 | 47 | Toshi MARUYAMA | |
146 | 13 | Ross Wilson | Example for an SMTP service provider with no authentication. |
147 | |||
148 | <pre><code class="yml"> |
||
149 | production: |
||
150 | 56 | sceox x | delivery_method: :smtp |
151 | smtp_settings: |
||
152 | address: smtp.knology.net |
||
153 | port: 25 |
||
154 | domain: cybersprocket.com |
||
155 | 1 | Cyber Sprocket | </code></pre> |
156 | 5 | Eric Davis | |
157 | h3. Using sendmail command |
||
158 | |||
159 | 47 | Toshi MARUYAMA | Example for a unix system that uses the @/usr/sbin/sendmail@ command. |
160 | 5 | Eric Davis | |
161 | 13 | Ross Wilson | <pre><code class="yml"> |
162 | production: |
||
163 | 56 | sceox x | delivery_method: :sendmail |
164 | 1 | Cyber Sprocket | </code></pre> |
165 | 35 | Jean-Baptiste Barth | |
166 | h2. Troubleshooting |
||
167 | |||
168 | h3. Error: "hostname was not match with the server certificate" |
||
169 | |||
170 | 56 | sceox x | 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 "smtp_settings" section: |
171 | 48 | Toshi MARUYAMA | |
172 | 35 | Jean-Baptiste Barth | <pre><code class="yml"> |
173 | 48 | Toshi MARUYAMA | enable_starttls_auto: false |
174 | 35 | Jean-Baptiste Barth | </code></pre> |
175 | 53 | Lloyd Su | |
176 | 56 | sceox x | If you have to enable starttls and just want to bypass the certificate verification, you can add following option in the appropriate "smtp_settings" section: |
177 | 53 | Lloyd Su | |
178 | <pre><code class="yml"> |
||
179 | openssl_verify_mode: "NONE" |
||
180 | </code></pre> |
||
181 | 36 | Richard Gomes | |
182 | h3. Error: "Mail failure - no recipient addresses" |
||
183 | |||
184 | 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. |
||
185 | 39 | Richard Gomes | |
186 | 36 | 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. |
187 | 37 | Richard Gomes | |
188 | 36 | Richard Gomes | The solution consists on editing your _config/configuration.yml_ and making sure you define @arguments@ containing the string @"-i"@, as shown below: |
189 | 47 | Toshi MARUYAMA | |
190 | 36 | Richard Gomes | <pre><code class="yml"> |
191 | # default configuration options for all environments |
||
192 | 56 | sceox x | default: |
193 | delivery_method: :sendmail |
||
194 | sendmail_settings: |
||
195 | arguments: "-i" |
||
196 | 47 | Toshi MARUYAMA | </code></pre> |
197 | 36 | Richard Gomes | |
198 | 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. |
199 | 38 | Richard Gomes | |
200 | 43 | hongbo yang | h3. Error: "Timeout:Error" due to SSL SMTP server connection |
201 | |||
202 | 1 | Cyber Sprocket | add an ssl option to the configuration.yml #17239 |
203 | 43 | hongbo yang | |
204 | 47 | Toshi MARUYAMA | <pre><code class="yml"> |
205 | 42 | hongbo yang | default: |
206 | # Outgoing emails configuration (see examples above) |
||
207 | email_delivery: |
||
208 | delivery_method: :smtp |
||
209 | smtp_settings: |
||
210 | address: smtp.domain.com |
||
211 | port: 465 |
||
212 | ssl: true |
||
213 | enable_starttls_auto: true |
||
214 | domain: domain.com |
||
215 | authentication: :login |
||
216 | user_name: redmine@domain.com |
||
217 | password: xxxx |
||
218 | 47 | Toshi MARUYAMA | </code></pre> |
219 | 42 | hongbo yang | |
220 | 7 | Mischa The Evil | h2. More information |
221 | 5 | Eric Davis | |
222 | * "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration |