Skip to content

Instantly share code, notes, and snippets.

@osulyanov
Last active May 3, 2017 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osulyanov/8f53f61e6cdee46413a53dda77502fcc to your computer and use it in GitHub Desktop.
Save osulyanov/8f53f61e6cdee46413a53dda77502fcc to your computer and use it in GitHub Desktop.
class ApplicationMailer < ActionMailer::Base
default from: Setting.first.email_from
add_template_helper(EmailHelper)
layout 'mailer'
end
module EmailHelper
def email_image_tag(image, **options)
attachments[image] = File.read(Rails.root.join("app/assets/images/#{image}"))
image_tag attachments[image].url, **options
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment