Project

General

Profile

RedmineReceivingEmails » History » Version 3

Jean-Philippe Lang, 2008-06-24 22:16
eols

1 1 Jean-Philippe Lang
h1. Receiving emails
2
3 2 Jean-Philippe Lang
As of r1572, Redmine can be configured to allow issue creation or comments via email.
4 1 Jean-Philippe Lang
5
h2. Setup
6
7
You can configure Redmine to receive emails in one of the following ways.
8
9
h3. Fetching emails from an IMAP server
10
11
A rake task (@redmine:email:receive_imap@) can be used to fetch incoming emails from an IMAP server.
12
13
It accepts the following options:
14
15
  * host      => IMAP server host (default: 127.0.0.1)
16
  * port      => IMAP server port (default: 143)
17
  * ssl       => Set this option to 1 to enable SSL (default: false)
18
  * username  => IMAP account
19
  * password  => IMAP password
20
  * folder    => IMAP folder to read (default: INBOX)
21
22
Other options:
23
24
  * project   => identifier of the project the issue should be added to
25
26
Example:
27
28
<pre>
29
rake redmine:email:receive_imap host=imap.domain \
30
                                username=redmine@domain \
31
                                password=xxx \
32
                                project=foo \              # => all issues will be added to project "foo"
33
                                RAILS_ENV="production"
34
</pre>
35
36
Emails that are ignored (unknown user, unknown project...) are marked as 'Seen' but are not deleted from the IMAP server.
37
38
h3. Reading emails from standard input
39
40
A rake task (@redmine:email:receive@) can be used to read a single raw email from the standard input.
41
42
Options:
43
44
  * project   => identifier of the project the issue should be added to
45
46
Postfix or Sendmail can be configured to forward incoming emails to this script.
47
See: http://wiki.rubyonrails.org/rails/pages/HowToReceiveEmailsWithActionMailer
48
49
Example of a Postfix alias:
50
51
  redmine: "|(cd /path/to/redmine && rake redmine:email:receive RAILS_ENV=production)" 
52
53
54
h2. How it works
55
56 3 Jean-Philippe Lang
When receiving an email, Redmine uses the From address of the email to find the corresponding user. Emails received from unknow or locked users are ignored.
57 1 Jean-Philippe Lang
58 3 Jean-Philippe Lang
If the email subject contains something like "Re: *[xxxxxxx !#123]*", the email is processed as a reply and a note is added to issue !#123. Otherwise, a new issue is created.
59 1 Jean-Philippe Lang
60 3 Jean-Philippe Lang
If you don't use the @project@ option when reading emails, users have to specify in the email body which project the issue should be added to. This can be done by inserting a line in the email body like this: @"Project: foo"@.
61 1 Jean-Philippe Lang
62
Example (email body):
63
64
<pre>
65
This is a new ticket that will be added to project foo.
66
Here we have the ticket description
67
[...]
68
69
Project: foo
70
</pre>
71
72 3 Jean-Philippe Lang
Of course, user permissions are checked and this email would be ignored if the user who sent this email is not allowed to add issues to project foo.