Mercurial > hg > soundsoftware-site
comparison lib/tasks/email.rake @ 1525:fb9a13467253 live
Merge from branch redmine-2.5-integration
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:45:02 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1515:d98d22a98252 | 1525:fb9a13467253 |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2014 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
27 ignore: email is ignored (default) | 27 ignore: email is ignored (default) |
28 accept: accept as anonymous user | 28 accept: accept as anonymous user |
29 create: create a user account | 29 create: create a user account |
30 no_permission_check=1 disable permission checking when receiving | 30 no_permission_check=1 disable permission checking when receiving |
31 the email | 31 the email |
32 no_account_notice=1 disable new user account notification | |
33 default_group=foo,bar adds created user to foo and bar groups | |
32 | 34 |
33 Issue attributes control options: | 35 Issue attributes control options: |
34 project=PROJECT identifier of the target project | 36 project=PROJECT identifier of the target project |
35 status=STATUS name of the target status | 37 status=STATUS name of the target status |
36 tracker=TRACKER name of the target tracker | 38 tracker=TRACKER name of the target tracker |
51 tracker=bug \\ | 53 tracker=bug \\ |
52 allow_override=tracker,priority < raw_email | 54 allow_override=tracker,priority < raw_email |
53 END_DESC | 55 END_DESC |
54 | 56 |
55 task :read => :environment do | 57 task :read => :environment do |
56 options = { :issue => {} } | 58 MailHandler.receive(STDIN.read, MailHandler.extract_options_from_env(ENV)) |
57 %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] } | |
58 options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] | |
59 options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] | |
60 options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] | |
61 | |
62 MailHandler.receive(STDIN.read, options) | |
63 end | 59 end |
64 | 60 |
65 desc <<-END_DESC | 61 desc <<-END_DESC |
66 Read emails from an IMAP server. | 62 Read emails from an IMAP server. |
67 | 63 |
71 ignore: email is ignored (default) | 67 ignore: email is ignored (default) |
72 accept: accept as anonymous user | 68 accept: accept as anonymous user |
73 create: create a user account | 69 create: create a user account |
74 no_permission_check=1 disable permission checking when receiving | 70 no_permission_check=1 disable permission checking when receiving |
75 the email | 71 the email |
72 no_account_notice=1 disable new user account notification | |
73 default_group=foo,bar adds created user to foo and bar groups | |
76 | 74 |
77 Available IMAP options: | 75 Available IMAP options: |
78 host=HOST IMAP server host (default: 127.0.0.1) | 76 host=HOST IMAP server host (default: 127.0.0.1) |
79 port=PORT IMAP server port (default: 143) | 77 port=PORT IMAP server port (default: 143) |
80 ssl=SSL Use SSL? (default: false) | 78 ssl=SSL Use SSL? (default: false) |
122 :password => ENV['password'], | 120 :password => ENV['password'], |
123 :folder => ENV['folder'], | 121 :folder => ENV['folder'], |
124 :move_on_success => ENV['move_on_success'], | 122 :move_on_success => ENV['move_on_success'], |
125 :move_on_failure => ENV['move_on_failure']} | 123 :move_on_failure => ENV['move_on_failure']} |
126 | 124 |
127 options = { :issue => {} } | 125 Redmine::IMAP.check(imap_options, MailHandler.extract_options_from_env(ENV)) |
128 %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] } | |
129 options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] | |
130 options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] | |
131 options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] | |
132 | |
133 Redmine::IMAP.check(imap_options, options) | |
134 end | 126 end |
135 | 127 |
136 desc <<-END_DESC | 128 desc <<-END_DESC |
137 Read emails from an POP3 server. | 129 Read emails from an POP3 server. |
138 | 130 |
155 :apop => ENV['apop'], | 147 :apop => ENV['apop'], |
156 :username => ENV['username'], | 148 :username => ENV['username'], |
157 :password => ENV['password'], | 149 :password => ENV['password'], |
158 :delete_unprocessed => ENV['delete_unprocessed']} | 150 :delete_unprocessed => ENV['delete_unprocessed']} |
159 | 151 |
160 options = { :issue => {} } | 152 Redmine::POP3.check(pop_options, MailHandler.extract_options_from_env(ENV)) |
161 %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] } | |
162 options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] | |
163 options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] | |
164 options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] | |
165 | |
166 Redmine::POP3.check(pop_options, options) | |
167 end | 153 end |
168 | 154 |
169 desc "Send a test email to the user with the provided login name" | 155 desc "Send a test email to the user with the provided login name" |
170 task :test, [:login] => :environment do |task, args| | 156 task :test, [:login] => :environment do |task, args| |
171 include Redmine::I18n | 157 include Redmine::I18n |