2012-03-09 5 views
0

템플릿에서 전자 메일을 만들고 전자 메일에 .csv 파일을 첨부하려고합니다. 전자 메일은 첨부 파일을 통해서만 제공되며 내용은 무시됩니다. 내가 여기서 뭘 잘못하고 있는거야?내 이메일에 Rails 2.2에 내용이없고 첨부 파일 만있는 이유는 무엇입니까?

def send_email(csv_file, results) 
    @subject = "subject here" 
    @from = "hl7_data mailer<[email protected]>" 
    @recipients = HL7_DATA_EMAIL_ADDRESS 
    @results = results 
    attachment :content_type => "text/csv", :body => csv_file 
    end 

mailer_view/send_email.html.erb: 
    Here is my content for the hl7 data email file: <%[email protected]%> 

내 파일 내용이 올바르게 표시되지만 파일을 첨부했는데 표시가 중단 되었습니까?

왜 그런가? 다음 첨부 파일을 허용해야

@content_type = "multipart/mixed" 

이 : 첨부 파일을 보내려면

답변

0

내가 무엇을 찾고 있었다입니다 : 그러니까 기본적으로

content = "here is my content" 
part :content_type => "text/plain", :charset => "us-ascii", :body => cont 
attachment :filename => 'invalid-records.csv', :disposition => "attachment", :content_type => "text/csv", :body => csv_file 

, 나는 기존 뷰 파일을 사용 coulndt, 나는 인라인 컨텐츠를 만들 수 있었다 : mailer_view/send_email.html.erb

0

, 당신은 @content_type을 변경해야합니다. 그래서 여기

+0

이 기본 콘텐츠 _ 때를 첨부 파일을 추가하십시오. – Kamilski81

관련 문제