Reputation: 22238
I have a Rails app that sends a PDF to the user. I am producing this email with the following mailer code:
def new_file_notification
mail(:to => '[email protected]', :subject => "File for #{Time.now.to_s(:uk)}") do |format|
format.html
format.pdf do
attachments['my_file.pdf'] = File.read(Rails.root.join('tmp', 'my_files', "my_file_#{@my_file.id}.pdf"))
end
end
end
Whilst this produces an email that is fine in Sparrow and the GMail interface, this does not come out well in Apple Mail. I see the attachment, but do not see any of the email HTML, but also have a second blank attachment called "Mail Attachment.pdf"
What am I doing wrong?
Upvotes: 0
Views: 444
Reputation: 4879
I think you should remove format.pdf
as doesn't this suggest that PDF is a viable format for the e-mail itself? It should only be .html or .text I think. Your attachment should just go under HTML format.
Upvotes: 2