Reputation: 4649
I am building the Email where I am parsing the .csv file which consists of email id's.Here is the code
File.open("#{Rails.root.to_s}/public/files/#{params["file"].original_filename}", "wb"){|file| file.write(params["file"].read) }
arr_of_arrs = CSV.read("#{Rails.root.to_s}/public/files/#{params["file"].original_filename}")
puts arr_of_arrs
arr_of_arrs.each do |i|
Here is the Mail sending process which is called in my Controller
Class.method(i[0]).deliver)
And I call the ActionMailer to send emails which are in the .csv file.And I am using AWS SES to send the mails.
My problem is when ever it fails to send an email to a particular address the whole email sending stops and it would not send emails to the rest of the address. But even after it fails it should be able to send the email to the rest of the addresses, how can I handle this issue since I am newbie to the ruby on rails.
Upvotes: 0
Views: 168
Reputation: 10874
This doesn't seem to have anything to do with delayed_job.
To not stop the remaining emails, catch the exception which breaks the loop:
arr_of_arrs.each do |i|
begin
Class.method(i[0]).deliver
rescue => e
# perhaps you'd like to log e's detail here
end
end
Upvotes: 2