views:

12

answers:

1

If I attach xls files as attachment in the mailer like this

attachments["1.xls"] = File.read "1.xls"

If I try open the attachment from the received mail, Excel is unable to open and it says the file is corrupted.

Please let me know if I am missing something? Please let me know if additional information is needed?

A: 

Found the answer here http://www.dixis.com/?paged=3

Apparently The correct way to attach binary files on Windows is

attachments[file_name] = File.open(file_location, 'rb'){|f| f.read}
Ram