I have problem in attaching a file as an option in Pony and Sinatra, how can I specify attachment options in Pony?
Asked
Active
Viewed 616 times
1 Answers
2
You just pass a hash of filenames => contents:
Pony.mail(
:to => 'recipient@example.com',
: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)

Seamus Abshere
- 8,326
- 4
- 44
- 61