Archangel.Associate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-11 23:49 UTC
ActionMailer Difficulties
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-SdeMhGcD7n3GMufIjQWhmTe48wsgrGvP@public.gmane.org"
@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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
