0

ビューのコンテンツが表示されていません。添付ファイルのみが送信されます。助けていただければ幸いです!

def send
 @subject = "Status of PIS App"
 @recipients = "ssg@gmail.com"
 @from = APP_CONFIG[:email]
 @sent_on = Time.now
 #@content_type = "text/html"
 content_type = "multipart/alternative"

 attachment :filename => "Report.html",:content_type => "text/html",
  :body => File.read("/home/shreyas/repos/mysorepoc/app/models/new1.html")
end
4

1 に答える 1

1

添付ファイルを使用する場合は、テキスト部分を個別に指定する必要があります。

def send
  @subject = "Status of PIS App"
  @recipients = "ssg@gmail.com"
  @from = APP_CONFIG[:email]
  @sent_on = Time.now
  #@content_type = "text/html"
  content_type = "multipart/mixed"

  part :content_type => "text/plain", :body => "contents of body"

  attachment :filename => "Report.html",:content_type => "text/html", :body => File.read("/home/shreyas/repos/mysorepoc/app/models/new1.html")
end

また、メールを multipart/alternative としてではなく、multipart/mixed として送信することをお勧めします (添付ファイルが実際にテキスト部分の代替表現でない限り)。

于 2010-08-03T16:54:01.723 に答える