Forum: Ruby on Rails Calling ActionMailer model from script/console

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.
71ee1809f53df0a2b4dac0530f630933?d=identicon&s=25 Richard Schneeman (snowmaninthesun)
on 2009-03-19 05:11
I am writing an app that receives emails and forwards them to different
locations based on certain criteria. I can recieve emails, and i can
send them, i'm just having a problem linking the two together.

The mailer model i am using is entitled My_Mailer and under that model i
have defined a receive method, and a welcome method. The recieve gets
the email, and the welcome sends another email. Right now i have
something like this


class MyMailer < ActionMailer::Base

  def receive(email)
     # parse and do ruby magic
     MyMailer.deliver_welcome(user_name, email_address )
  end

  def welcome(name, email)
    #  sends a welcome message
  end
end

Why when i call MyMailer.deliver_welcome(user_name, email_address ) from
my script/console i can send an email just fine but when i call it
within the recieve method, it doesn't work. Do you have any clue why a
line of code would work from script/console but not in a model?

Also if i try to debug or call "puts 'something'" within the MyMailer
model nothing shows up in the console output.
This topic is locked and can not be replied to.