Are you asking how to use Merb::Mailer from outside of a controller? If
so, you can do something like this:

    users.each do |u|
      mail = Merb::Mailer.new({
        :to => u.email,
        :from => MY_EMAIL,
        :subject => "[awesomesauce.com] Monthly report",
        :text => u.text_for_monthly_report
      })

      mail.deliver!
    end

On Sun, Jun 13, 2010 at 02:08:34AM -0700, Dan Sosedov wrote:
> Is there any good example how to send emails from rake tasks? For
> example, i have a task that executed every month be able to send
> emails to specific users.
> 
> # monthly.rake file
> namespace :periodic do
>   task :monthly => :merb_env do
>     users = User.all(........)
>     users.each do |u|
>         .... some operations ....
>        and here goes block that should send email.
>     end
>   end
> end
> 
> Ideas?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "merb" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/merb?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to