How to add Cloudinary file as email attachment in Action Mailer Ruby
I am building a job application in Rails and I need to attach resumes(cv) that are uploaded in a job application as an email attachment. All files in the application are uploaded to Cloudinary using CarrierWave. Emails are handled by Action Mailer. In ActionMailer, I have
class ApplicantMailer < ApplicationMailer
def applicant_info(applicant)
@applicant = applicant
mail(to: @applicant.job.email, subject: 'Applicant Details')
end
end
In my mailer view template, I have
<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>
At the moment, this does not render the cloudinary file as an attachment in the email. I need to be able to render the resume as a readable attachment file.
-
Official comment
Hey,
Thank you for reaching out.
Please use the following
<%= cl_image_tag(@applicant.resume, :flags=>"attachment") %>
which will result the following URL: image/upload/fl_attachment/@applicant.resumeHope this helps, please let us know if you have any further questions.
Best,
-- Tal
Comment actions
Please sign in to leave a comment.
Comments
1 comment