How to include logo into devise messages
06 Jun 05:54

Add this line to config/initializers/devise.rb

config.parent_mailer = 'ApplicationMailer'

Create the ApplicationMailer

class ApplicationMailer < ActionMailer::Base
  before_action :add_inline_attachment!

  private

  def add_inline_attachment!
    attachments.inline['logo.png'] = File.read(
      Rails.root.join('app', 'assets', 'images', 'your_logo.png')
    )
  end
end

Use logo in message templates or mailer layout

= image_tag attachments['logo.png'].url

Comments

Joe
Dariasz
Wow, that's great, thank you
Joe
ali
Thanks @Dariasz