Forum: Ruby on Rails Why won't my ActionMailer work inside the controller?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Duane M. (Guest)
on 2009-05-29 00:08
I've got a basic mailer setup and am simply trying to get a Hello
message through.  If I go into script/console and execute

Emailer.deliver_message("removed_email_address@domain.invalid","My subject", "My
message")

it works fine.

However, if I fire up a controller with a test method that invokes the
same thing

def test
   Emailer.deliver_message("removed_email_address@domain.invalid","My subject", 
"My
message")
end


I never see the message.  Something obvious I'm missing in the context
of running it in the controller?
Frederick C. (Guest)
on 2009-05-30 14:14
(Received via mailing list)
On May 28, 9:08 pm, Duane M. <removed_email_address@domain.invalid>
wrote:
>
> def test
>    Emailer.deliver_message("removed_email_address@domain.invalid","My subject", "My
> message")
> end
>
> I never see the message.  Something obvious I'm missing in the context
> of running it in the controller?

Shouldn't be. Stupid question : are you sure the code is actually
getting run? (the action name may be relevant here) Is the instance of
rails serving your web request running with a different RAILS_ENV (ie
potentially different action mailer settings) ?

Fred
This topic is locked and can not be replied to.