Using the ActionMailer and Mandrill APIs to send to multiple recipients

I am trying to get an application to send notifications to all administrators when certain actions are performed. Everything works fine if I have only one administrator, but I always get an error when there are several administrators. I use a granulator to give roles to user administrators, and Mandrill to send emails. In my Mandrill dash, I get successful API calls when this is done, but when I test it using the console, I get an error.

In my mail file:

def new_ticket_created ticket

    to = User.with_role(:administrator).map{|user| user.email}.uniq.join ','
    mail to: to, subject: "New ticket created!"
  end

The error I get in the console is:

ProjectMailer#new_ticket_created: processed outbound mail in 418.7ms
[{"email"=>"admin_user@validemail.com, admin_user2@validemail.com", "status"=>"invalid", "reject_reason"=>nil}]

, 1 , admin, . , , , , .

+4

Source: https://habr.com/ru/post/1599204/


All Articles