Ruby on Rails Wednesday, April 24, 2013

Hello,
i have a Loop where an email is sent to several adresses one by one.
works fine, but if i attach a file it works only for the first adress
correctly. THe other get the mailtext, but no attachment (coorct name,
but 0 Bytes)
Any Idea why?
TIA


Code of the controller:
def gruppenmail_schreiben
puts "------------------"
attach = params[:attachment]
params[:auftragnr].each do |t|
if t != '0'
neuemail = Writtenmail.new
neuemail.attachment = attach
neuemail.betreff = params[:betreff]
neuemail.body = params[:body]
neuemail.candidate_id = t
neuemail.absender = current_fakusers.email
neuemail.email = mailsuchen(t)
neuemail.save
mailsenden(neuemail)
end

end
redirect_to :controller => 'anzeige', :action => 'suchmaske'
end #Ende gruppenmail_schreiben

def mailsenden(mail)
Notifier.deliver_multipart_alternative_rich(
#t,#
mail.email,
mail.betreff,
mail.body,
mail.candidate_id,
mail.attachment,
mail.absender
)

No comments:

Post a Comment