summaryrefslogtreecommitdiffstats
path: root/lib/tasks/email.rake
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-17 13:53:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-17 13:53:13 +0000
commit3eb815fddd76e121f9572e84dde17111fc5588a5 (patch)
tree9a0c7622220200eaf863aa76de1aaf31da938139 /lib/tasks/email.rake
parentb4cf8ea52512b6db80262a508f1b30b3e3cfbd39 (diff)
downloadredmine-3eb815fddd76e121f9572e84dde17111fc5588a5.tar.gz
redmine-3eb815fddd76e121f9572e84dde17111fc5588a5.zip
Adds a rake task to receive emails from a POP3 server (#2420).
See: rake -D redmine:email:receive_pop3 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3330 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/tasks/email.rake')
-rw-r--r--lib/tasks/email.rake33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake
index 37fbd4261..87b5e03ce 100644
--- a/lib/tasks/email.rake
+++ b/lib/tasks/email.rake
@@ -132,5 +132,38 @@ END_DESC
Redmine::IMAP.check(imap_options, options)
end
+
+ desc <<-END_DESC
+Read emails from an POP3 server.
+
+Available POP3 options:
+ host=HOST POP3 server host (default: 127.0.0.1)
+ port=PORT POP3 server port (default: 110)
+ username=USERNAME POP3 account
+ password=PASSWORD POP3 password
+ apop=1 use APOP authentication (default: false)
+ delete_unprocessed=1 delete messages that could not be processed
+ successfully from the server (default
+ behaviour is to leave them on the server)
+
+See redmine:email:receive_imap for more options and examples.
+END_DESC
+
+ task :receive_pop3 => :environment do
+ pop_options = {:host => ENV['host'],
+ :port => ENV['port'],
+ :apop => ENV['apop'],
+ :username => ENV['username'],
+ :password => ENV['password'],
+ :delete_unprocessed => ENV['delete_unprocessed']}
+
+ options = { :issue => {} }
+ %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
+ options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
+ options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
+ options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
+
+ Redmine::POP3.check(pop_options, options)
+ end
end
end