Forum: Ruby on Rails Problem with mailer

Posted by Paul Bergstrom (palb)
on 2011-03-09 18:45
I created a new mailer called Notifier. When I try that I get
"SystemStackError (stack level too deep):". Any ideas of what could be
wrong?
Posted by Vladimir Rybas (Guest)
on 2011-03-09 19:12
(Received via mailing list)
Post your mailer content here: http://pastie.org/
As well as stack trace.

"Stack level too deep" could mean you got an infinite loop. Maybe
you're calling method inside itself.
Posted by Paul Bergstrom (palb)
on 2011-03-10 12:54
Vladimir Rybas wrote in post #986535:
> Post your mailer content here: http://pastie.org/
> As well as stack trace.
>
> "Stack level too deep" could mean you got an infinite loop. Maybe
> you're calling method inside itself.

I have a test method as:

def test
   Notifier.message().deliver
end

And a mailer as:


class Notifier < ActionMailer::Base
  default :from => "from@xxxxxx.info"

  def message()
     mail(:to => 'hello@xxxxx.com', :subject => "Test")
  end

end

Btw, I can have any name I want on the mailer, right? I thought of 
having one mailer for the entire app.
Posted by Paul Bergstrom (palb)
on 2011-03-10 13:37
Got it working. I tried with a new mailer, using the same name as a 
controller and model, and  I changed :enable_starttls_auto => true to 
false (as I got an ssl cert error).
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.