diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 6f7e596..ec06647 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -2,4 +2,19 @@ class ApplicationMailer < ActionMailer::Base default from: ENV['default_mail_from'] layout 'mailer' + + before_action :inline_layout_images + + private + + def inline_layout_images + # inline images requested in default mailer layout + attachments.inline['perficientdigital-logo.jpg'] = image_file('perficientdigital-logo.jpg') + attachments.inline['yellowslant-left.jpg'] = image_file('yellowslant-left.jpg') + attachments.inline['yellowslant-right.jpg'] = image_file('yellowslant-right.jpg') + end + + def image_file image + File.read(Rails.root.to_s + "/app/assets/images/#{image}") + end end diff --git a/app/views/layouts/mailer.html.inky b/app/views/layouts/mailer.html.inky index 2969c38..12f03c3 100644 --- a/app/views/layouts/mailer.html.inky +++ b/app/views/layouts/mailer.html.inky @@ -26,7 +26,7 @@ ©2016 All Rights Reserved - Perficient Digital
- <%= image_tag("yellowslant-left.jpg", alt:"Perficient Digital") %> + <%= image_tag(attachments["yellowslant-left.jpg"].url, alt:"Perficient Digital") %> | - <%= image_tag("yellowslant-right.jpg", alt:"Perficient Digital") %> + <%= image_tag(attachments["yellowslant-right.jpg"].url, alt:"Perficient Digital") %> |