<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,6 +12,15 @@ namespace :customer do
     desc &lt;&lt;-END_DESC
 Read emails from an IMAP server, create users but do not notifying them.
 
+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 but do not notificate user
+                           notify: create a user account
+        
+
 Available IMAP options:
   host=HOST                IMAP server host (default: 127.0.0.1)
   port=PORT                IMAP server port (default: 143)
@@ -52,34 +61,19 @@ Examples:
     allow_override=tracker,priority
 END_DESC
     task :receive_imap =&gt; :environment do
-      imap_options = {:host =&gt; ENV['host'],
-                      :port =&gt; ENV['port'],
-                      :ssl =&gt; ENV['ssl'],
-                      :username =&gt; ENV['username'],
-                      :password =&gt; ENV['password'],
-                      :folder =&gt; ENV['folder'],
-                      :move_on_success =&gt; ENV['move_on_success'],
-                      :move_on_failure =&gt; ENV['move_on_failure']}
-                      
-      options = { :issue =&gt; {} }
-      %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] = 'create'
+      if ENV['unknown_user'] == 'create'
+        turn_off_mailer
+      end
 
-      with_mailer_turned_off do
-        Redmine::IMAP.check(imap_options, options)
+      if ENV['unknown_user'] == 'notify'
+        ENV['unknown_user'] = 'create'
       end
+
+      Rake::Task['redmine:email:receive_imap'].invoke
     end
   end
 end
 
-def with_mailer_turned_off
-  turn_of_mailer
-  yield
-  turn_on_mailer
-end
-
 def turn_off_mailer
   class &lt;&lt; Mailer
     def deliver_account_information(user, password)
@@ -88,8 +82,3 @@ def turn_off_mailer
   end
 end
 
-def turn_on_mailer
-  class &lt;&lt; Mailer
-    remove_method :deliver_account_information
-  end
-end</diff>
      <filename>lib/tasks/customer.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a11e01b4ab258d098b4464a6d4699544908548db</id>
    </parent>
  </parents>
  <author>
    <name>elomar.franca</name>
    <email>elomar.franca@2ba885dd-6bb3-41cd-a376-88fc31cd222d</email>
  </author>
  <url>http://github.com/elomar/customer-plugin/commit/030577aa51edf56a5114c8c4ecc18d72ddd64593</url>
  <id>030577aa51edf56a5114c8c4ecc18d72ddd64593</id>
  <committed-date>2009-11-09T19:46:04-08:00</committed-date>
  <authored-date>2009-11-09T19:46:04-08:00</authored-date>
  <message>Suportando todas as op&#231;&#245;es antigas, acrescentando notify pra criar e notificar

git-svn-id: https://svn.renapi.org/customer-plugin/trunk@69 2ba885dd-6bb3-41cd-a376-88fc31cd222d</message>
  <tree>e0badb3e871d754ddd75a5cbbbcc51add4a39ac2</tree>
  <committer>
    <name>elomar.franca</name>
    <email>elomar.franca@2ba885dd-6bb3-41cd-a376-88fc31cd222d</email>
  </committer>
</commit>
