Project

General

Profile

RedmineReceivingEmails » History » Version 2

Jean-Philippe Lang, 2008-06-24 22:08
revision number updated

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
When receiving an email, Redmine uses the From address of the email to
57
find the corresponding user. Emails received from unknow or locked users are ignored.
58
59
If the email subject contains something like "Re: *[xxxxxxx !#123]*", the email is processed as a reply
60
and a note is added to issue !#123. Otherwise, a new issue is created.
61
62
If you don't use the @project@ option when reading emails, users have to specify in the email body
63
which project the issue should be added to. This can be done by inserting a line in the
64
email body like this: @"Project: foo"@.
65
66
Example (email body):
67
68
<pre>
69
This is a new ticket that will be added to project foo.
70
Here we have the ticket description
71
[...]
72
73
Project: foo
74
</pre>
75
76
Of course, user permissions are checked and this email would be ignored if the user who sent this email is not
77
allowed to add issues to project foo.