jeudi 21 avril 2016

ruby on rails action mailer not receiving emails to arrays from a yaml file

I have an issue where i am able to send email via the mailer for a hardcoded array. But the email does not go through for an array picked up from config.yml

Here is my config.yml

company:
  email:
    - user1@company.com
    - User1.Lastname@company.com
    - User2.Lastname@company.com

This is my mailer class:

class ReportMailer < ActionMailer::Base
  default :from => "donotreply@company.com"


  def send_report(company, file)

      mail(:to=> "#{CONFIG[company]['email']}", :subject => "Daily  Report")
    end
  end
end

when run it in my rails console & view the logs, seems like everything was executed fine but I did not receive my email:

[DEBUG] 2016-04-21 18:21:29 :: Date: Thu, 21 Apr 2016 18:21:29 -0400
From: donotreply@merchantlink.com
to: ["user1@company.com", "User1.Lastname@company.com","User2.Lastname@company.com"]
 ...
 ...

 [INFO] 2016-04-21 18:21:29 ::
Sent mail to ["user1@company.com", "User1.Lastname@company.com", "User2.Lastname@company.com"]

If i change my code & replace it with hardcoded array instead of reading from config.yml it works fine.

Am i reading the yaml array wrong?

Aucun commentaire:

Enregistrer un commentaire