Skip to main content

Attach image to summernote and send email

Rails • Asked by Lee Terng Gio

I recently implement email in my rails app. I'm using summernote to create email templates and save it. Everything works fine. I can upload image to the editor and save it to database. But when I send the email template, the image in the email that I'd received is broken. I didn't use any uploader to handle the image uploaded, the image was encoded in Base64, so how do I fix this?

My mailer.rb
def message_send(candidate_mail)
@candidate_mail = candidate_mail

mail(

  to: "#{@candidate_mail.to}",

  from: "#{@candidate_mail.from}",

  subject: "#{@candidate_mail.subject}",

  body: "#{@candidate_mail.body}",

  content_type:  "text/html",

  important: true,

  inline_css: true,


  )

end


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.