我正在Rails中构建一个工作申请,我需要将上传到工作申请中的简历(cv)附加为电子邮件附件。使用CarrierWave将应用程序中的所有文件上传到Cloudinary。电子邮件由Action Mailer处理。在ActionMailer中,我有
class ApplicantMailer < ApplicationMailer
def applicant_info(applicant)
@applicant = applicant
mail(to: @applicant.job.email, subject: 'Applicant Details')
end
end
在我的邮件查看器模板中,我有
<p>Hi Recruiter, in this email, you would find the resume of the latest applicant</p>
<p>Resume: <%= cl_image_tag(@applicant.resume, :attachment=>true) %></p>
目前,这并未将cloudinary文件呈现为电子邮件中的附件。我需要能够将简历呈现为可读的附件文件。
答案 0 :(得分:0)
类似的事情应该起作用。我认为您不需要那个帮手
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
class ApplicantMailer < ApplicationMailer
def applicant_info(applicant)
@applicant = applicant
attachments[ open(applicant.resume) ]
mail(to: @applicant.job.email, subject: 'Applicant Details')
end
end