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]’
body “sender_name” => sender_name, “event” => event
attachment :context_type => 'image/png', :body => File.read('public/images/rails.png')
BTW, i am using rails 2.1.2, ruby 1.8.6
What did i miss out? Any suggestions will be greatly appreciated.