Jeff added an imag" />

Jeff added an imag" />

Jeff added an imag"/>

Adding inline image in mail body using Mail Gem

193 views Asked by At

I am using Mail Gem for sending email. I am trying to send .PNG files using inline image tag like below

record_stream << "<br /> <p>Jeff added an image today.</p>"
  .concat( "<img src="pngImagePath" /> " )

mail = Mail.new do
  from    '[email protected]'
  to      '[email protected]'
  subject "Automated Report
  html_part do
    body "<i>This is an automated email.  All data in this email was generated automatically.</i>
          #{record_stream}
        "
  end
end #### End of mailer

But when I check my gmail record_stream does not appear. Neither the string nor the images. I want to display both in email body. Any help will be greatly appreciated. Thanks

1

There are 1 answers

0
jorgedjr21 On

First thing, the Image Path should have an url link for the image and not a relative path (because the email doesn't has access to the image in your server).

You can try add the image directly in the html_part body to see if works

Hope this helps you