提问人:Hernan Acosta 提问时间:10/1/2022 最后编辑:Hernan Acosta 更新时间:10/1/2022 访问量:178
通过邮戳发送电子邮件时如何截断 HtmlBody
How can I truncate the HtmlBody when sending emails through postmark
问:
我在我的 rails 应用程序中使用邮戳发送电子邮件,其中电子邮件内容是自动生成的。问题是在某些情况下,我从邮戳中收到此错误。
Postmark::InvalidEmailAddressError
Invalid 'HtmlBody' value. It should be less than 5242880 characters in length.
如何截断 HtmlBody 内容以避免此错误使用ActionMailer
答: 暂无答案
评论
message.body = message.body.truncate(5242880)
Nokogiri.HTML5(truncated_string).to_html