title: ActionMailer loop on rake task send an extra mail every time it runs
body: <p>I cannot figure this out, 
  I have this class</p>
  
  <pre><code>class UserMailer &lt; ActionMailer::Base
   def apps_remainder_email()
      #apps array ..which basically have 3 records in it
      apps.each do |rec||
      mail(to:  user.email, subject: 'Apps Remainder').deliver
      end
   end
  end
  </code></pre>
  
  <p>When I try to call the above in rails console <code>UserMailer.apps_remainder_email</code> it is working fine and sending out three emails, but When I add this as a rake task it sends out four instead of three i.e always a duplicate of final email. </p>
  
  <p>Here is my rake task</p>
  
  <pre><code>task daily: [:environment] do  
   UserMailer.apps_remainder_email.deliver
  end
  </code></pre>
  
  <p>I think it is because I have a .deliver in my task, but without that .deliver no mails are sending at all.</p>
  
  <pre><code>  $ rake daily --trace
      ** Invoke daily (first_time)
      ** Invoke environment (first_time)
      ** Execute environment
      ** Execute daily
  </code></pre>