次のコードを使用して、pdf が添付された電子メールを送信しています。
class StudyMailer < ActionMailer::Base
def notify_office(study, sent_at = Time.now)
subject "Email Subject Goes Here"
recipients 'user@domain.come'
from "#{study.sender.full_name} <#{study.sender.email}>"
sent_on sent_at
body :study => study
for document in study.documents
attachment :content_type => "application/pdf", :body => File.read(document.document.path) #absolute path to .pdf document
end
end
end
電子メールが送信されると、添付ファイルは .pdf 添付ファイルとしてではなく、バイナリ コードとしてインラインでレンダリングされるようです。
インラインではなく、一般的な添付ファイルとして .pdf をレンダリングするにはどうすればよいですか?