I'm using ActionMailer in test mode (so, in the config file I have
config.action_mailer.delivery_method = :test
) I have my mailer set up as such...
def confirm(message, sending_user, user) @subject = "You have a message from #{sending_user.login}" @body["message"] = message @body["user"] = user @body["sender"] = sending_user @recipients = user.email @from = "admin@queer.berkeley.edu" @sent_on = Time.now end
And my confirm page set up as follows
Dear <%= @user.name %> <%= @sender.login %> has sent you the following message %> <%= @message %>
Now, if I let @user be some user and @sending_user be some other user, if I work from the console with
MessageSender.deliver_confirm("Message!", @sending_user, @user)
it works, and I see the message in the hash built by the test mode. But if I use the following code
def send_message @user = (session[:looked_upon_user]) @sending_user = User.find(session[:user_id]) @message = (params[:message]) MessageSender.deliver_confirm(@message, @sending_user, @user) end
it doesn't, even though the send message page works, with the following code
<h1> Message Sent! </h1> <p> <%= @sending_user.login %> sent the message </p> <p> <%= @message %> </p> to <%= @user.login %> <%= link_to "Return", :action => "index" %>
I've been programming with Ruby on Rails for a few months now and am still trying to get the hang of it. Any help would be greatly appreciated.