2013-02-06 2 views

답변

1

이메일에 첨부하려면 pdf를 이진 파일로 변환 할 필요가 없습니다. 단지 당신은 아마 첨부 파일로 PDF 파일을 보낼

attachments["filename.pdf"] = File.read("/path/to/filename.pdf")

1

당신의 우편물의 방법 안에이 줄을 추가합니다. 공식 레일 ActionMailer이

class UserMailer < ActionMailer::Base 
    def welcome_email(user) 
    @user = user 
    @url = user_url(@user) 
    attachments['terms.pdf'] = File.read('/path/terms.pdf') 
    mail(:to => user.email, 
     :subject => "Please see the Terms and Conditions attached") 
    end 
end 

http://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-attachments

을 수행하는 방법에 대한 예제를 가지고
관련 문제