[Backgroundrb-devel] problems with ActionMailer

Charles Brian Quinn me at seebq.com
Mon Aug 7 00:34:41 EDT 2006


Your workers reside in lib/workers, which means the path for them back
to RAILS_ROOT is back two levels, and thus the mail templates are back
two as well:

File.expand_path(File.dirname(__FILE__) + "../../../file.txt"))

see:  http://rubyforge.org/pipermail/backgroundrb-devel/2006-August/000163.html

posted just a few days ago....
-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com


On 8/7/06, Rolando Abarca <funkaster at gmail.com> wrote:
> Hi all,
> I'm trying to create a worker to send a mail to all the users in my
> db. Right now I'm doing the tests, this is the code in my worker
> (Masivo is the ActionMailer subclass):
>
>  def do_work(args)
>    @progress = 0
>    @logger.info("MAILER: starting job")
>    records = Record.find(:all)
>    total = records.size
>    records.each_with_index do |record, idx|
>      recipients = record.emails.to_a
>      email = Masivo.create_mail_prueba(recipients)
>      email.set_content_type("text/html")
>      Masivo.deliver(email)
>      sleep(10) # this is here for testing purposes
>    end
>    @logger.info("MAILER: job done")
>    @progress = 100
>  end
>
> this is the code in Masivo:
>
>  def mail_prueba(recipients)
>    @recipients = recipients
>    @from = "myself at mydomain.com"
>    @subject = "test email"
>    @sent_on = Time.now
>    @body = {}
>  end
>
> If I do this, I get an exception:
>
> No rhtml, rxml, rjs or delegate template found for mail_prueba -
> (ActionView::ActionViewError)
>
> I had to put a render :file at the end of the mail_prueba function,
> and even that way the email is not sent... Any ideas on what could be
> the problem?
>
> btw... this is the code in the controller that creates the worker:
>
>  def email_prueba
>    MiddleMan.new_worker(:class => :mailer_worker, :args => "",
> :job_key => :emailer)
>    redirect_to(:action => 'email_prueba_progress')
>  end
>
>  def email_prueba_progress
>    render(:text => "Progreso: #{MiddleMan[:emailer].progress}")
>  end
>
> thanks for any hint.
> --
> rolando -- [[ knowledge is empty, fill it ]] --
> "Tam pro papa quam pro rege bibunt omnes sine lege."
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>


More information about the Backgroundrb-devel mailing list