title: How to send an email with an inline image in Rails 4
body: <p>I am working on a rails application and want to send an email with an inline image to the email address that the user enters. I have been struggling to do it. I checked online and this is what I did. </p>
  
  <p>When I enter an email in development it gives me an error saying, 
  ActionController::UnknownFormat</p>
  
  <p>This is my ActionMailer Notifier.rb</p>
  
  <pre><code>class Notifier &lt; ActionMailer::Base
  default from: "insidespintex@gmail.com"
  
  
  
  def enter_email(sending)
  
  @coming = sending
  attachments.inline['blank'] = {
  :data =&gt; File.read("#{Rails.root.to_s + '/app/assets/images/News.png'}"),
  :mime_type =&gt; "image/png",
  :encoding =&gt; "base64"
   }
  mail :to =&gt; @coming.email, :subject =&gt; 'InsideSpintex is coming soon'
  
     end
    end
  </code></pre>
  
  <p>This is my ApplicationController LandingController.rb</p>
  
  <pre><code>class LandingController &lt; ApplicationController
  
  layout 'landingPage'
  
  def soon
  
      @coming = Coming.new
  
  end
  
  def after
      render 'after'
  end
  
  def save_email
      @coming = Coming.new(soon_params)
  
  
      respond_to do |format|
          if @coming.save
              Notifier.enter_email(@coming).deliver
               format.html { render action: 'after' }
              #render 'after'
           else
              render 'soon'
  
      end
   end
  end
  #render 'soon'
  private
      def soon_params
          params.require(:coming).permit(:email)
      end
  end
  </code></pre>
  
  <p>And this is my View enter_email.html.erb</p>
  
  <pre><code>&lt;p&gt; Hello There,&lt;/h3&gt;
      &lt;%= image_tag attachments['News.png'] %&gt; 
  </code></pre>