이메일 목록이 있습니다. 그리고 나는 각 사용자가 이메일을 수신 할 필요가있다. 이메일을 보낼 때 도움이 필요합니다.
그래서 만든 :script/generate mailer Notifier
다음
. app/views/notifier/newgrants_notification.erb
에서
class Notifier < ActionMailer::Base
def newgrants_notification(respondent)
recipients user.email
from "[email protected]"
subject "Hi!"
body (:respondent => respondent)
end
end
썼다 : Hello!
내가 질문을 내가 무슨 짓을했는지 실수
@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
을 만들이 내 컨트롤러? 메시지가 오지 않습니다 (
고맙습니다. 지금은 이해합니다. 프로젝트가 프로덕션 모드 일 때만 전자 메일이 수신됩니까? –
수신자 user.email도 확인하십시오 – Bijendra
http://stackoverflow.com/questions/5485348/how-does-actionmailer-work/5485972#5485972 – Bijendra