Reputation: 14504
In one of my mailers I have this method to send an e-mail with an attached pdf:
def send_offer(customer, ip)
@customer = customer
attachments['offer.pdf'] = {
:encoding => 'base64',
:content => Base64.encode64(File.read(Rails.root.join('app', 'assets', 'images', 'offer.pdf')))
}
mail(:to => "[email protected]",
:from => "[email protected]",
:body =>"this tag is important when do any attachment",
:subject => "#{@customer[:name]} Offer")
end
The e-mails is send, but when I open it the attached PDF is broken. The file size is 670 bytes
.
The original PDF is 263 KB (269.485 byte)
How can that be?
Upvotes: 1
Views: 1201