I'm working on a basic contact form as part of learning Ruby where there are a string of email addresses in an array and the message in a contact form is sent to each one through Rails Pony.
ADDRESSES_BOOK = ['example1@example.com', 'example2@example.com']
def deliver
return false unless valid?
ADDRESSES_BOOK.each do |address|
Pony.mail({
:to => ADDRESSES_BOOK[address],
:from => %("#{name}" <#{email}>),
:reply_to => email,
:subject => subject,
:body => contactFormMessage,
})
end
end
I'm doing something wrong with the loop, as it throws the error "no implicit conversion of String into Integer."
What am I doing wrong here?
Thanks!