# body of email not displaying with attachments in rails2.3.5

**URL:** <https://discuss.rubyonrails.org/t/body-of-email-not-displaying-with-attachments-in-rails2-3-5/67877>\
**Category:** rubyonrails-talk\
**Created:** [September 29, 2013, 7:13am UTC](https://discuss.rubyonrails.org/t/body-of-email-not-displaying-with-attachments-in-rails2-3-5/67877 "2013-09-29T07:13:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Achuthan1](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@Pradeep\_Achuthan1](https://discuss.rubyonrails.org/u/Pradeep_Achuthan1)\
**Post date:** [September 29, 2013, 7:13am UTC](https://discuss.rubyonrails.org/t/body-of-email-not-displaying-with-attachments-in-rails2-3-5/67877/1 "2013-09-29T07:13:58Z")

</div>

I am sending an email through my application to other user’s gmail id. I am receiving email and it works fine without attachment. But when I attach a file, the mail which users receive contain subject and attachments only. The body part is not displaying in the mail. In the controller I am passing everything as params to reminder\_email method. I am using rails2.3.5…This is how I have implemented in my mailer.rb file. Please help.

```
class ReminderMailer < ActionMailer::Base

  def reminder_email(sender,recipients, subject, message,attachments)
    recipient_emails = (recipients.class == String) ? recipients.gsub(' ','').split(',').compact : recipients.compact
    setup_reminder_email(sender, recipient_emails, subject, message,attachments)
  end

  protected
  def setup_reminder_email(sender, emails, subject, message,files)
    @from = sender
    @recipients = emails
    @subject = subject
    @sent_on = Time.now
    @body['message'] = message
    #content_type = "multipart/alternative"
     files.each do |file|
      attachment "application/octet-stream" do |a|
      a.body = file.read
      a.filename = file.original_filename
    end unless file.blank?
    end
  end
end

```
