Wanna send a picture in a mail using ROR

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

class MyMailer < ActionMailer::Base
  def send()
    @subject    = 'this is a test of my mailing system'
    @body       = {:pic=>show}
    @recipients = '[email protected]'
    @from       = '[email protected]'
    @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 %>


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

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://blog.jebelev.com/2007/10/how-to-send-inline-images-with-action.html
http://blog.thoughtobject.com/2007/05/26/5/

Best regards

Peter De Berdt

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

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

inline attachment can work , right now I’m trying

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs