# Image attachment in mail with rails3

**URL:** <https://www.ruby-forum.com/t/image-attachment-in-mail-with-rails3/221795>\
**Category:** Rails\
**Created:** [July 31, 2012, 12:30pm UTC](https://www.ruby-forum.com/t/image-attachment-in-mail-with-rails3/221795 "2012-07-31T12:30:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 31, 2012, 12:30pm UTC](https://www.ruby-forum.com/t/image-attachment-in-mail-with-rails3/221795/1 "2012-07-31T12:30:30Z")

</div>

yes this will send one mail with attachment of image.png. But when i  
open  
or download that image, that is empty.?

imageurl =  
[![](https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=5&choe=UTF-8) ](https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=5&choe=UTF-8)  
require ‘open-uri’  
class UserMailer \< ActionMailer::Base  
default :from =\> “removed\_email\_address@domain.invalid”

def welcome\_email(imageurl,mailid)

```
attachments['QR.png'] = {:mime_type => 'image/png',
                                 :content => 

```

open(URI.parse(imageURL))}  
mail(:to =\> mailid,  
:subject =\> “Code”,  
:body =\> “Code”)  
end  
end

Thanks  
vishnu
