Hi There,
Anyone know of a nice basic way to send an email in ruby on rails?
I''m thinking of allowing my site members to reccomend/invite friends
by entering their email address and hitting send.
At a guess, to begin with I think i''d need:
 def message(mail)
    subject     mail[:message].subject
    from        ''someone''
    recipients  mail[:recipient].email
    body        mail
  end
then a message page, which is displayed to the user in the email
invitation they receive: similar to:
<%= @user.name %> at site ABC123 thinks you should check out this
site:
site name and url here....
Is there a way to implement this in a nice easy way, ensuring that a
user can log in, enter a friend''s email address, send it and their
friend recieve the invite?
cheers
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
A framework for sending emails is already built into Rails. Its called ActionMailer. http://wiki.rubyonrails.org/howtos/mailers -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I recommend http://guides.rubyonrails.org/action_mailer_basics.html  it 
is a good place to get started.
If you had a mailer named CraigMailer and you had the message defined 
like above
class CraigMailer < ActionMailer::Base
 def message(mail)
    subject     mail[:message].subject
    from        ''someone''
    recipients  mail[:recipient].email
    body        mail
  end
end
Then you can send your email by calling 
CraigMailer.deliver_message(mail) which will send your email provided 
you have smtp settings setup in your production.rb file.
--
Richard Schneeman
http://whyspam.me
-- 
Posted via http://www.ruby-forum.com/.
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.