Amazon s3 回形针图像不';不显示在行动邮件
我正在编写一个非常简单的电子邮件模板,用于发送带有嵌入图像的HTML电子邮件。图像使用回形针gem存储在AWS S3中:Amazon s3 回形针图像不';不显示在行动邮件,amazon-s3,ruby-on-rails-5,paperclip,actionmailer,Amazon S3,Ruby On Rails 5,Paperclip,Actionmailer,我正在编写一个非常简单的电子邮件模板,用于发送带有嵌入图像的HTML电子邮件。图像使用回形针gem存储在AWS S3中: <%= image_tag @press_release.image.try(:attachment).try(:url, :preview), alt: 'zimplePR', style: 'width: 85%; max-height: 200px; object-fit: cover;' %> 在制作过程中,该image\u标签helper在我的we
<%= image_tag @press_release.image.try(:attachment).try(:url, :preview), alt: 'zimplePR', style: 'width: 85%; max-height: 200px; object-fit: cover;' %>
在制作过程中,该image\u标签
helper在我的web视图中起到了魅力的作用,但由于某些原因,它没有显示在我发送的电子邮件中
我在某个地方读到,可能是因为回形针的完整附件url类似于//s3.amazonaws.com/…
,并且预先加上“http:”应该可以,但这只适用于Gmail,而不适用于苹果的电子邮件
是否有一种方法可以使用回形针将图像嵌入ActionMailer模板,并在所有电子邮件客户端中显示?我发现了问题,该错误的原因是我没有指定附件的:http协议:
Class Image < ApplicationRecord
has_attached_file :attachment,
:styles => {
:thumb => ['80x80>', :png],
:preview => ['600x600>', :png]
},
:convert_options =>{
:thumb => "-quality 80 -interlace Plane",
:preview => "-quality 80 -interlace Plane",
},
:default_url => 'images/missing_:style.png',
:s3_protocol => :https,
:s3_credentials => {
:bucket => Rails.application.credentials[:aws][:s3_bucket_production]
}
end
类映像{
:thumb=>['80x80>,:png],
:preview=>[600x600>,:png]
},
:convert_options=>{
:thumb=>“-质量80-交错平面”,
:预览=>“-质量80-交错平面”,
},
:default_url=>“images/missing_u:style.png”,
:s3_协议=>:https,
:s3_凭证=>{
:bucket=>Rails.application.credentials[:aws][:s3\u bucket\u production]
}
结束