attachment is not proper in mail in rails

Posted by Harsh Raval on Stack Overflow See other posts from Stack Overflow or by Harsh Raval
Published on 2010-12-30T07:42:38Z Indexed on 2010/12/30 7:53 UTC
Read the original article Hit count: 279

Filed under:
|
|

hi, i'm sending a mail with attachment(1.pdf) but in mail it doesnt shows 1.pdf instead it shows some random file named "ATT008220.dat".

i'm using Rails 3.0 following is the code i'm using:

        @file = File.read('c:/1.pdf')
        @file.force_encoding('BINARY')
        attachment "application/octet-stream" do |a|
            a.body = @file
        end

anybody knows why its happening? any idea?

Thanks & Regards,

Harsh Raval.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about email