mardi 16 octobre 2018

How to add cloudinary file as email attachment in ActionMailer

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.

Aucun commentaire:

Enregistrer un commentaire