Having some problem with sending email with attachment:

I am able to send an email without attachment via gmail server.

However, when i tried to send an image attachment, it is corrupted at
the recipient mailbox; coz the mail received:
  (1) Has the attachment, but not able to open the image file.
  (2) The attachment image file size is much smaller.
  (3) The message in the email body is missing (which was there if i
send without the attachment portion).

Below is the part of my model code:

============== models/event_mailer.rb ======================
class EventMailer < ActionMailer::Base
  def email_friend(recipient, sender_name, event)
    subject       'Check out this great event'
    from          '[EMAIL PROTECTED]'
    recipients    recipient
    content_type  'text/html'
    body          "sender_name" => sender_name, "event" => event

    attachment  :context_type => 'image/png',
                :body     => File.read('public/images/rails.png')
  end
end

BTW, i am using rails 2.1.2, ruby 1.8.6

What did i miss out? Any suggestions will be greatly appreciated.

Thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to