视图中的内容未显示。仅发送附件。帮助将不胜感激!
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
答案 0 :(得分: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 / mixed发送,而不是作为multipart / alternative(除非附件确实是文本部分的替代表示)。