Project

General

Profile

EmailConfiguration » History » Version 42

hongbo yang, 2014-06-20 11:21

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 30 Miodrag Milic
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":http://answers.bitnami.org/questions/4421/updating-an-issue-in-redmine-takes-10-seconds 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
<pre>
40
development:
41
  email_delivery:
42
    delivery_method: :async_smtp
43
    async_smtp_settings:
44
    ...
45
</pre>
46
47 11 Etienne Massip
h2. Example configuration.yml Configurations
48 1 Cyber Sprocket
49
h3. Simple Login Authentication (default settings)
50
51
<pre>
52
# 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 1 Cyber Sprocket
</pre>
76
77
78
*If you want to use GMail/Google Apps and other TLS-requiring SMTP servers*, you'll have to add some TLS-related settings :
79 8 Joël Lamotte
80
<pre>
81
production:
82 12 Ross Wilson
  email_delivery:
83
    delivery_method: :smtp
84
    smtp_settings:
85
      enable_starttls_auto: true
86
      address: "smtp.gmail.com" 
87
      port: '587'
88
      domain: "smtp.gmail.com" 
89
      authentication: :plain
90
      user_name: "your_email@gmail.com" 
91 1 Cyber Sprocket
      password: "your_password" 
92 8 Joël Lamotte
93
</pre>
94
95 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.
96
97
<pre>
98
production:
99
  email_delivery:
100
    delivery_method: :smtp
101
    smtp_settings:
102
      enable_starttls_auto: true
103
      address: "smtp.office365.com"
104
      port: '587'
105
      domain: "your_domain.com"
106
      authentication: :login
107
      user_name: "email@your_domain.com"
108
      password: "password"
109
</pre>
110
111 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).
112
(See #5814 )
113
114 1 Cyber Sprocket
h3. No Authentication
115
116 34 Anonymous
Example for an SMTP service provider with no authentication.
117 1 Cyber Sprocket
118
<pre>
119 13 Ross Wilson
production:
120
  email_delivery:
121
    delivery_method: :smtp
122
    smtp_settings:
123
      address: smtp.knology.net
124
      port: 25
125
      domain: cybersprocket.com
126 1 Cyber Sprocket
</pre>
127
128
h3. Using sendmail command
129 5 Eric Davis
130
Example for a unix system that uses the @/usr/sbin/sendmail@ command.
131
132
<pre>
133
production:
134 13 Ross Wilson
  email_delivery:
135
    delivery_method: :sendmail
136 5 Eric Davis
</pre>
137 1 Cyber Sprocket
138 35 Jean-Baptiste Barth
h2. Troubleshooting
139
140
h3. Error: "hostname was not match with the server certificate"
141
142
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:
143
144
    enable_starttls_auto: false
145
146 36 Richard Gomes
h3. Error: "Mail failure - no recipient addresses"
147
148
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.
149
150 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.
151 36 Richard Gomes
152 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:
153 36 Richard Gomes
154
<pre>
155
# default configuration options for all environments
156
default:
157
  email_delivery:    
158
    delivery_method: :sendmail
159
    sendmail_settings:
160
      arguments: "-i" 
161
</pre>
162
163 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.
164 38 Richard Gomes
165 42 hongbo yang
h3. Error: "Timeout:error" due to SSL SMTP server connection
166
add an ssl option to the configuration.yml #17239
167
<pre>
168
default:
169
  # Outgoing emails configuration (see examples above)
170
  email_delivery:
171
    delivery_method: :smtp
172
  smtp_settings:
173
    address: smtp.domain.com
174
    port: 465
175
    ssl: true
176
    enable_starttls_auto: true
177
    domain: domain.com
178
    authentication: :login
179
    user_name: redmine@domain.com
180
    password: xxxx
181
</pre>
182
183 7 Mischa The Evil
h2. More information
184 5 Eric Davis
185
* "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration