# Redmine - project management software\r
-# Copyright (C) 2006-2008 Jean-Philippe Lang\r
+# Copyright (C) 2006-2011 Jean-Philippe Lang\r
#\r
# This program is free software; you can redistribute it and/or\r
# modify it under the terms of the GNU General Public License\r
# as published by the Free Software Foundation; either version 2\r
# of the License, or (at your option) any later version.\r
-# \r
+#\r
# This program is distributed in the hope that it will be useful,\r
# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
# GNU General Public License for more details.\r
-# \r
+#\r
# You should have received a copy of the GNU General Public License\r
# along with this program; if not, write to the Free Software\r
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
create: create a user account\r
no_permission_check=1 disable permission checking when receiving\r
the email\r
- \r
+\r
Issue attributes control options:\r
project=PROJECT identifier of the target project\r
status=STATUS name of the target status\r
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']\r
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']\r
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']\r
- \r
+\r
MailHandler.receive(STDIN.read, options)\r
end\r
- \r
+\r
desc <<-END_DESC\r
Read emails from an IMAP server.\r
\r
create: create a user account\r
no_permission_check=1 disable permission checking when receiving\r
the email\r
- \r
+\r
Available IMAP options:\r
host=HOST IMAP server host (default: 127.0.0.1)\r
port=PORT IMAP server port (default: 143)\r
username=USERNAME IMAP account\r
password=PASSWORD IMAP password\r
folder=FOLDER IMAP folder to read (default: INBOX)\r
- \r
+\r
Issue attributes control options:\r
project=PROJECT identifier of the target project\r
status=STATUS name of the target status\r
allow_override=ATTRS allow email content to override attributes\r
specified by previous options\r
ATTRS is a comma separated list of attributes\r
- \r
+\r
Processed emails control options:\r
move_on_success=MAILBOX move emails that were successfully received\r
to MAILBOX instead of deleting them\r
move_on_failure=MAILBOX move emails that were ignored to MAILBOX\r
- \r
+\r
Examples:\r
# No project specified. Emails MUST contain the 'Project' keyword:\r
- \r
+\r
rake redmine:email:receive_iamp RAILS_ENV="production" \\\r
host=imap.foo.bar username=redmine@example.net password=xxx\r
\r
\r
# Fixed project and default tracker specified, but emails can override\r
# both tracker and priority attributes:\r
- \r
+\r
rake redmine:email:receive_iamp RAILS_ENV="production" \\\r
host=imap.foo.bar username=redmine@example.net password=xxx ssl=1 \\\r
project=foo \\\r
:folder => ENV['folder'],\r
:move_on_success => ENV['move_on_success'],\r
:move_on_failure => ENV['move_on_failure']}\r
- \r
+\r
options = { :issue => {} }\r
%w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }\r
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']\r
\r
Redmine::IMAP.check(imap_options, options)\r
end\r
- \r
+\r
desc <<-END_DESC\r
Read emails from an POP3 server.\r
\r
\r
See redmine:email:receive_imap for more options and examples.\r
END_DESC\r
- \r
+\r
task :receive_pop3 => :environment do\r
pop_options = {:host => ENV['host'],\r
:port => ENV['port'],\r
:username => ENV['username'],\r
:password => ENV['password'],\r
:delete_unprocessed => ENV['delete_unprocessed']}\r
- \r
+\r
options = { :issue => {} }\r
%w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }\r
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']\r
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']\r
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']\r
- \r
+\r
Redmine::POP3.check(pop_options, options)\r
end\r
- \r
+\r
desc "Send a test email to the user with the provided login name"\r
task :test, :login, :needs => :environment do |task, args|\r
include Redmine::I18n\r
\r
user = User.find_by_login(args[:login])\r
abort l(:notice_email_error, "User #{args[:login]} not found") unless user && user.logged?\r
- \r
+\r
ActionMailer::Base.raise_delivery_errors = true\r
begin\r
Mailer.deliver_test(User.current)\r