0

I have am practicing by making a wedding site. Unfortunately, I have not been able to get my emails to send to the guests who've RSVP'd. I am not sure what should follow :to =>

Rsvp_Mailer.rb

class RsvpMailer < ActionMailer::Base

  def rsvp_email(primary, guests, message)
    @primary = primary
    @guests  = guests
    @message = message

    subject_prefix = primary.attending? ? "Attending" : "Not Attending"

    mail(:from => '"www.personaldomain.com" <no-reply@personaldomain.com>', :to => '???' :subject => "New RSVP - #{subject_prefix} : #{primary.first_name} #{primary.last_name} + #{@guests.size}")
  end
end

1 Answers1

0

You need to pass an email address of the recipient to the :to, like this:

mail(:from => '"www.personaldomain.com" <no-reply@personaldomain.com>', :to => 'user@example.com' :subject => "New RSVP - #{subject_prefix} : #{primary.first_name} #{primary.last_name} + #{@guests.size}")

That means that you have to call RsvpMailer.rsvp_email.deliver for every user that needs to get that message.

Ilya Sabanin
  • 786
  • 5
  • 9