EmailConfiguration » History » Version 36

Richard Gomes, 2013-11-15 06:03

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 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 23 Miodrag Milic
39 23 Miodrag Milic
<pre>
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 23 Miodrag Milic
</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 1 Cyber Sprocket
<pre>
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 1 Cyber Sprocket
</pre>
76 1 Cyber Sprocket
77 1 Cyber Sprocket
78 1 Cyber Sprocket
*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 8 Joël Lamotte
<pre>
81 8 Joël Lamotte
production:
82 12 Ross Wilson
  email_delivery:
83 12 Ross Wilson
    delivery_method: :smtp
84 12 Ross Wilson
    smtp_settings:
85 12 Ross Wilson
      enable_starttls_auto: true
86 12 Ross Wilson
      address: "smtp.gmail.com" 
87 12 Ross Wilson
      port: '587'
88 12 Ross Wilson
      domain: "smtp.gmail.com" 
89 12 Ross Wilson
      authentication: :plain
90 12 Ross Wilson
      user_name: "your_email@gmail.com" 
91 1 Cyber Sprocket
      password: "your_password" 
92 8 Joël Lamotte
93 8 Joël Lamotte
</pre>
94 8 Joël Lamotte
95 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).
96 8 Joël Lamotte
(See #5814 )
97 8 Joël Lamotte
98 1 Cyber Sprocket
h3. No Authentication
99 1 Cyber Sprocket
100 34 Anonymous
Example for an SMTP service provider with no authentication.
101 1 Cyber Sprocket
102 1 Cyber Sprocket
<pre>
103 13 Ross Wilson
production:
104 13 Ross Wilson
  email_delivery:
105 13 Ross Wilson
    delivery_method: :smtp
106 13 Ross Wilson
    smtp_settings:
107 13 Ross Wilson
      address: smtp.knology.net
108 13 Ross Wilson
      port: 25
109 13 Ross Wilson
      domain: cybersprocket.com
110 1 Cyber Sprocket
</pre>
111 1 Cyber Sprocket
112 1 Cyber Sprocket
h3. Using sendmail command
113 5 Eric Davis
114 5 Eric Davis
Example for a unix system that uses the @/usr/sbin/sendmail@ command.
115 5 Eric Davis
116 5 Eric Davis
<pre>
117 5 Eric Davis
production:
118 13 Ross Wilson
  email_delivery:
119 13 Ross Wilson
    delivery_method: :sendmail
120 5 Eric Davis
</pre>
121 1 Cyber Sprocket
122 35 Jean-Baptiste Barth
h2. Troubleshooting
123 35 Jean-Baptiste Barth
124 35 Jean-Baptiste Barth
h3. Error: "hostname was not match with the server certificate"
125 35 Jean-Baptiste Barth
126 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:
127 35 Jean-Baptiste Barth
128 35 Jean-Baptiste Barth
    enable_starttls_auto: false
129 35 Jean-Baptiste Barth
130 36 Richard Gomes
h3. Error: "Mail failure - no recipient addresses"
131 36 Richard Gomes
132 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.
133 36 Richard Gomes
134 36 Richard Gomes
This error is common on *Debian* boxes, due to way _exim4_ is configured by default, trying to find the destination address inside the header of the message. Instead, we need to configure _exim4_ so that the destination address will be retrieved from the command line.
135 36 Richard Gomes
136 36 Richard Gomes
The solution consists on editing your _config/configuration.yml_ and making sure you define @sendmail_settings@ as shown below:
137 36 Richard Gomes
138 36 Richard Gomes
<pre>
139 36 Richard Gomes
# default configuration options for all environments
140 36 Richard Gomes
default:
141 36 Richard Gomes
  email_delivery:    
142 36 Richard Gomes
    delivery_method: :sendmail
143 36 Richard Gomes
    sendmail_settings:
144 36 Richard Gomes
      arguments: "-i" 
145 36 Richard Gomes
</pre>
146 36 Richard Gomes
147 36 Richard Gomes
148 7 Mischa The Evil
h2. More information
149 5 Eric Davis
150 5 Eric Davis
* "Action Mailer Configuration":http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration