##// END OF EJS Templates
Rails3: scm: bazaar: fix error of test_fetch_changesets_incremental at unit model test...
Rails3: scm: bazaar: fix error of test_fetch_changesets_incremental at unit model test On Rails 3.1, ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection error raises. For more details, see r7062. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7073 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6948:83133302f41f
r6953:1a99a5a64a79
Show More
email.rake
186 lines | 8.0 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
IMAP: add options to move received emails....
r2218 # Redmine - project management software
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820 # Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820 #
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820 #
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Philippe Lang
Adds a rake task (redmine:email:receive_imap) to read emails from an IMAP server (#1110)....
r1555 namespace :redmine do
namespace :email do
desc <<-END_DESC
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 Read an email from standard input.
Jean-Philippe Lang
Ability to accept incoming emails from unknown users (#2230, #3003)....
r2689 General options:
unknown_user=ACTION how to handle emails from an unknown user
ACTION can be one of the following values:
ignore: email is ignored (default)
accept: accept as anonymous user
create: create a user account
Jean-Philippe Lang
Adds a 'no_permission_check' option to the MailHandler....
r3081 no_permission_check=1 disable permission checking when receiving
the email
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 Issue attributes control options:
project=PROJECT identifier of the target project
Jean-Philippe Lang
Adds status option to email integration rake tasks....
r2073 status=STATUS name of the target status
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 tracker=TRACKER name of the target tracker
category=CATEGORY name of the target category
priority=PRIORITY name of the target priority
allow_override=ATTRS allow email content to override attributes
specified by previous options
ATTRS is a comma separated list of attributes
Examples:
# No project specified. Emails MUST contain the 'Project' keyword:
rake redmine:email:read RAILS_ENV="production" < raw_email
# Fixed project and default tracker specified, but emails can override
# both tracker and priority attributes:
rake redmine:email:read RAILS_ENV="production" \\
project=foo \\
tracker=bug \\
allow_override=tracker,priority < raw_email
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 END_DESC
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 task :read => :environment do
options = { :issue => {} }
Jean-Philippe Lang
Adds status option to email integration rake tasks....
r2073 %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
Jean-Philippe Lang
Ability to accept incoming emails from unknown users (#2230, #3003)....
r2689 options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
Jean-Philippe Lang
Adds a 'no_permission_check' option to the MailHandler....
r3081 options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 MailHandler.receive(STDIN.read, options)
end
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task (redmine:email:receive_imap) to read emails from an IMAP server (#1110)....
r1555 desc <<-END_DESC
Read emails from an IMAP server.
Jean-Philippe Lang
Ability to accept incoming emails from unknown users (#2230, #3003)....
r2689 General options:
unknown_user=ACTION how to handle emails from an unknown user
ACTION can be one of the following values:
ignore: email is ignored (default)
accept: accept as anonymous user
create: create a user account
Jean-Philippe Lang
Adds a 'no_permission_check' option to the MailHandler....
r3081 no_permission_check=1 disable permission checking when receiving
the email
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task (redmine:email:receive_imap) to read emails from an IMAP server (#1110)....
r1555 Available IMAP options:
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 host=HOST IMAP server host (default: 127.0.0.1)
port=PORT IMAP server port (default: 143)
ssl=SSL Use SSL? (default: false)
username=USERNAME IMAP account
password=PASSWORD IMAP password
folder=FOLDER IMAP folder to read (default: INBOX)
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 Issue attributes control options:
project=PROJECT identifier of the target project
Jean-Philippe Lang
Adds status option to email integration rake tasks....
r2073 status=STATUS name of the target status
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 tracker=TRACKER name of the target tracker
category=CATEGORY name of the target category
priority=PRIORITY name of the target priority
allow_override=ATTRS allow email content to override attributes
specified by previous options
ATTRS is a comma separated list of attributes
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
IMAP: add options to move received emails....
r2218 Processed emails control options:
move_on_success=MAILBOX move emails that were successfully received
to MAILBOX instead of deleting them
move_on_failure=MAILBOX move emails that were ignored to MAILBOX
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 Examples:
# No project specified. Emails MUST contain the 'Project' keyword:
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Toshi MARUYAMA
fix typo in imap examples at lib/tasks/email.rake (#9198)...
r6948 rake redmine:email:receive_imap RAILS_ENV="production" \\
Jean-Philippe Lang
Use example.net as domain in default configuration (#1762)....
r1763 host=imap.foo.bar username=redmine@example.net password=xxx
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629
# Fixed project and default tracker specified, but emails can override
# both tracker and priority attributes:
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Toshi MARUYAMA
fix typo in imap examples at lib/tasks/email.rake (#9198)...
r6948 rake redmine:email:receive_imap RAILS_ENV="production" \\
Jean-Philippe Lang
Use example.net as domain in default configuration (#1762)....
r1763 host=imap.foo.bar username=redmine@example.net password=xxx ssl=1 \\
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 project=foo \\
tracker=bug \\
allow_override=tracker,priority
Jean-Philippe Lang
Adds a rake task (redmine:email:receive_imap) to read emails from an IMAP server (#1110)....
r1555 END_DESC
task :receive_imap => :environment do
imap_options = {:host => ENV['host'],
:port => ENV['port'],
:ssl => ENV['ssl'],
:username => ENV['username'],
:password => ENV['password'],
Jean-Philippe Lang
IMAP: add options to move received emails....
r2218 :folder => ENV['folder'],
:move_on_success => ENV['move_on_success'],
:move_on_failure => ENV['move_on_failure']}
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 options = { :issue => {} }
Jean-Philippe Lang
Adds status option to email integration rake tasks....
r2073 %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
Jean-Philippe Lang
Mail handler: more control over issue attributes (#1110)....
r1629 options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
Jean-Philippe Lang
Ability to accept incoming emails from unknown users (#2230, #3003)....
r2689 options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
Jean-Philippe Lang
Adds a 'no_permission_check' option to the MailHandler....
r3081 options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
Jean-Philippe Lang
Adds a rake task (redmine:email:receive_imap) to read emails from an IMAP server (#1110)....
r1555
Redmine::IMAP.check(imap_options, options)
end
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task to receive emails from a POP3 server (#2420)....
r3216 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
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task to receive emails from a POP3 server (#2420)....
r3216 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']}
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task to receive emails from a POP3 server (#2420)....
r3216 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']
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Jean-Philippe Lang
Adds a rake task to receive emails from a POP3 server (#2420)....
r3216 Redmine::POP3.check(pop_options, options)
end
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Eric Davis
Add rake task to send test email. (#6511)...
r4142 desc "Send a test email to the user with the provided login name"
task :test, :login, :needs => :environment do |task, args|
include Redmine::I18n
Toshi MARUYAMA
use rake task parameter style message if redmine:email:test parameter is blank....
r5818 abort l(:notice_email_error, "Please include the user login to test with. Example: rake redmine:email:test[login]") if args[:login].blank?
Eric Davis
Add rake task to send test email. (#6511)...
r4142
user = User.find_by_login(args[:login])
Toshi MARUYAMA
handle a nil user in rake redmine:email:test task....
r5819 abort l(:notice_email_error, "User #{args[:login]} not found") unless user && user.logged?
Toshi MARUYAMA
remove trailing white-spaces from rake redmine:email:test task source....
r5820
Eric Davis
Add rake task to send test email. (#6511)...
r4142 ActionMailer::Base.raise_delivery_errors = true
begin
Mailer.deliver_test(User.current)
puts l(:notice_email_sent, user.mail)
rescue Exception => e
abort l(:notice_email_error, e.message)
end
end
Jean-Philippe Lang
Adds basic support for issue creation via email (#1110)....
r1554 end
end