recommending friends, using RoR's Mailer

Hi there, I wan tto be able to allow users to invite friends...

The action below is exactly the same as the code used to send a user their username. Only difference is, I need to change the ''user = User.find_by_email(email)'' part as obviously, I dont want to only email people who are already on the site.

  def invite         @title = "Invitation"

        if param_posted?(:user)           email = params[:user][:email]           user = User.find_by_email(email)           if user           UserMailer.deliver_invite(@user)           flash[:notice] = "Invite sent."           redirect_to :action => "index", :controller => "site"           else           flash[:notice] = "There is no user with that email address."         end       end     end

The UserMailer code is below:   def invite(user)       @subject = 'Invitation'       @body = {}     # Give body access to the user information.       @body["user"] = user       @recipients = user.email       @from = '<do-not-reply@domainname.com>'

  end

The last part is the call to the UserMailer that picks the template to send the relevant email..

UserMailer.deliver_invite(@user)

the _invite is the template in which is ultimately displayed to the chosen invitee.

ANy ideas how this can be altered to allow for the mail to be sent to anyone added to the input field?

Many Thanks