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


i have issue able send email via mailer hardcoded array. email not go through array picked config.yml

here config.yml

company:   email:     - user1@company.com     - user1.lastname@company.com     - user2.lastname@company.com 

this 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 in rails console & view logs, seems executed fine did not receive 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 ["user1@company.com", "user1.lastname@company.com", "user2.lastname@company.com"] 

if change code & replace hardcoded array instead of reading config.yml works fine.

am reading yaml array wrong?

as correctly pointed out in comment @alfie, passing stringified array to:.

config[company]['email'] returns array, string interpolation calls to_s on , end with

"['user1@company.com', 'user1.lastname@company.com','user2.lastname@company.com']" 

just pass in array without inserting string:

mail(:to=> config[company]['email'], :subject => "daily  report") 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -