I have a table of emails. And i need that Each user received email.
SO i made:
script/generate mailer Notifier
Next.
class Notifier < ActionMailer::Base
def newgrants_notification(respondent)
recipients user.email
from "lala@lala.com"
subject "Hi!"
body (:respondent => respondent)
end
end
In app/views/notifier/newgrants_notification.erb
wrote : Hello!
and this my controller where i create question
@question = Question.create(:text => params[:question][:text], :security => rand(888).to_i)
if success = @question.save
respondents = Respondent.find(:all)
respondents.each do |res|
Inquiry.create(:question_id=>@question.id.to_i, :respondent_id=>res.id.to_i)
Notifier.newgrants_notification(respondents).deliver #this is right??
end
what mistakes i did? messages aren’t coming ;(
HI
When you are sending mail,the mail id is passed as a parameter so respondents is replaced with res.