title: How to send a mail to all devise users?
body: <p>I have 100 devise users on my rails app and I want to send them emails. I have the SMTP details and I am trying to follow this example <a href="http://railscasts.com/episodes/61-sending-email-revised" rel="nofollow">http://railscasts.com/episodes/61-sending-email-revised</a></p>
  
  <p>My problem is I am not able to understand how to make it work ? </p>
  
  <p>I have created </p>
  
  <pre><code>rails g mailer newsletter single_email
  </code></pre>
  
  <p>but I am little unsure how to take it from there, any help will be highly appreciated </p>
  
  <p>EDIT - this is what I have so far, is this correct ? </p>
  
  <pre><code># app/mailers/user_mailer.rb
  
  class UserMailer &lt; ActionMailer::Base
    def newsletter(user)
      mail( to: user.email, subject: "Your subject")   
    end
  end
  
  # /lib/tasks/newsletter.rake
  
  task :send_newsletter =&gt; :environment do
    User.all.each do |user|
      UserMailer.newsletter(user).deliver
    end
  end
  </code></pre>