# Wanna send a picture in a mail using ROR

**URL:** <https://www.ruby-forum.com/t/wanna-send-a-picture-in-a-mail-using-ror/138365>\
**Category:** Rails\
**Created:** [May 22, 2008, 10:32am UTC](https://www.ruby-forum.com/t/wanna-send-a-picture-in-a-mail-using-ror/138365 "2008-05-22T10:32:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@stone](https://www.ruby-forum.com/u/stone)\
**Post date:** [May 22, 2008, 10:32am UTC](https://www.ruby-forum.com/t/wanna-send-a-picture-in-a-mail-using-ror/138365/1 "2008-05-22T10:32:18Z")

</div>

Hello , I got trouble here and need assist here !

All I wanna do is to send a [text/html] content-typed mail

I want to use the [send\_data] method to send the pic(id = 1 , name  
=‘aa’ , data, type= ‘jpeg’) from my database

```auto
class MyMailer < ActionMailer::Base
  def send()
    @subject = 'this is a test of my mailing system'
    @body = {:pic=>show}
    @recipients = 'removed_email_address@domain.invalid'
    @from = 'removed_email_address@domain.invalid'
    @sent_on = Time.now
    @headers = {}
    @content_type = "text/html"
  end

  def show
    @picture = Picture.find(1)
    send_data(
              @picture.data,
              :filename=>@picture.name,
              :type=>@picture.content_type,
              :dispotion=>"inline"
    )
  end

```

# this is send.erb ,

Dear

this is a testing letter , to see if i can send a pic via a mail

\<%= @pic %\>

```auto

surely won't work eh? but could I know what can we do to make it work
```

---

<div class="post-metadata">

**Author:** ![stone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@stone](https://www.ruby-forum.com/u/stone)\
**Post date:** [May 22, 2008, 11:45am UTC](https://www.ruby-forum.com/t/wanna-send-a-picture-in-a-mail-using-ror/138365/2 "2008-05-22T11:45:27Z")

</div>

On 22 May 2008, at 10:31, stone wrote:

> Hello , I got trouble here and need assist here !
> 
> All I wanna do is to send a [text/html] content-typed mail
> 
> I want to use the [send\_data] method to send the pic(id = 1 , name  
> =‘aa’ , data, type= ‘jpeg’) from my database

Simple google search: rails html mail inline images

[http://www.caboo.se/articles/2006/02/19/how-to-send-multipart-alternative-e-mail-with-inline-attachments](http://www.caboo.se/articles/2006/02/19/how-to-send-multipart-alternative-e-mail-with-inline-attachments)  
[http://blog.jebelev.com/2007/10/how-to-send-inline-images-with-action.html](http://blog.jebelev.com/2007/10/how-to-send-inline-images-with-action.html)  
[http://blog.thoughtobject.com/2007/05/26/5/](http://blog.thoughtobject.com/2007/05/26/5/)

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![stone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@stone](https://www.ruby-forum.com/u/stone)\
**Post date:** [May 23, 2008, 10:26am UTC](https://www.ruby-forum.com/t/wanna-send-a-picture-in-a-mail-using-ror/138365/3 "2008-05-23T10:26:43Z")

</div>

Hello , thanks for your help , but this method is out of date ☹

It wont wokr on rails 2.0 , or function imcomplete (link 2)

inline attachment can work , right now I’m trying
