# frozen_string_literal: true
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
