Calling ActionMailer model from script/console


#1

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.