Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:37:11+00:00 2026-06-05T14:37:11+00:00

I am trying to get a QR Code image to display in an email.

  • 0

I am trying to get a QR Code image to display in an email. I have tried to apply solutions from similar questions here at SO but have not been able to get any variation of them to work. I don’t want to download it from the site.

in my user_mailer.rb:

  def email_qrcode(from_whom, to_addy)
    @from_whom = from_whom
    @to_addy = to_addy
    attachments["qrcode.png"] = File.read(Rails.root + "public/images/qrcode.png")
    mail( :to => to_addy, :from => @from_whom.email, :subject => "QR Code" )
  end

in my email_qrcode.html.erb:

  <body>
    <p>Here is the QR Code:</p> 
    <p><img src="cid:qrcode.png"></p>
  </body>

The email content that is displayed:

Here is the QR Code: (followed by the little blue question mark indicating no image)

It is also included as an attachment, but having to double click it to open it defeats the convenience factor.

Thanks for your help.


UPDATE:

Good marketing is about removing every obstacle that you can to make it easier for the potential customer. The more times the QR code is displayed without having to find and click another link, the better the results will be. So, to be clear…

  1. The attachment is there. In some email clients web mail servers it will even display as an attachment below the email. However, many (maybe most… not sure) email clients and web mail servers will not display an attachment unless you click on them to open them… another click (obstacle).
  2. In addition, many clients and web mail servers will prevent the download and display of images without clicking on a link to approve display of the image. However, many of those clients and servers will NOT block an image that is embedded in the email. In other words putting in a link to download the image increases the likelihood of the display being blocked requiring a click (obstacle to potential customer) to open the image.

ANOTHER UPDATE: solution

user_mailer.rb:

attachments.inline["qrcode"] = {
                                :data => File.read("#{Rails.root.to_s + '/public/images/qrcode.png'}"),
                                :mime_type => "image/png",
                                :encoding => "base64"
                              }

email_qrcode.html.erb:

<%= image_tag( attachments['qrcode'].url, :id => 'qrcode' ) %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:37:12+00:00Added an answer on June 5, 2026 at 2:37 pm

    In your email_qrcode method, try changing:

    attachments.["qrcode.png"]

    to

    attachments.inline["qrcode.png"].

    This should get you moving in the right direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code to display image from URL, but it is not
I have this code here, but it's not working I just get No Process
I am trying to get the code found here: http://snipplr.com/view/26643/mbprogresshud-with-an-asynchronous-nsurlconnection-call/ to work in my
I have a project where we are trying to get the code space down.
I am trying to get the zip code of the users current location.I have
I'm trying to get this C++ code to input a series of numbers from
I'm trying to get just a piece of information from Facebook, but I don't
I'm trying to get an image to display with one of the colors replaced
So I'm trying to get my TabItem to display a different image depending on
I have a repeater trying to get multiple data to display. which includes a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.