Reputation: 11
I have problem in attaching a file as an option in Pony and Sinatra, how can I specify attachment options in Pony?
Upvotes: 1
Views: 627
Reputation: 8526
You just pass a hash of filenames => contents:
Pony.mail(
:to => '[email protected]',
:subject => "My Subject",
:body => "My Body",
:attachments => {
'CompanyReport.xls' => country_report_data
}
)
Now country_report_data
should be a String
, possibly with binary. If you wrote to a tempfile, you could do:
country_report_data = File.read('/tmp/1029102938123', :binmode => true)
Upvotes: 2