# Actionmailer - Multipart and Outlook?

**URL:** <https://discuss.rubyonrails.org/t/actionmailer-multipart-and-outlook/33919>\
**Category:** rubyonrails-talk\
**Created:** [September 2, 2008, 9:31pm UTC](https://discuss.rubyonrails.org/t/actionmailer-multipart-and-outlook/33919 "2008-09-02T21:31:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Simpson](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@Matt\_Simpson](https://discuss.rubyonrails.org/u/Matt_Simpson)\
**Post date:** [September 2, 2008, 9:31pm UTC](https://discuss.rubyonrails.org/t/actionmailer-multipart-and-outlook/33919/1 "2008-09-02T21:31:11Z")

</div>

Hi,

I’m having issues with getting a consistent result with the emails I am sending using Actionmailer.

Problem: Emails that I send with plain text, rich text, and attachments do not display the same results across GMail, Yahoo, Outlook and Thunderbird.

Scenario:

I am sending an email with text/plain, text/html, and 2 attachments using the code below, and I’ve specified the content\_type. GMail receives and displays the email perfectly but in outlook, none of the attachments are displayed, and in thunderbird, the last attachment is displayed, and in yahoo, none of the attachments display. I’ve followed many tutorials including the guide in the actionmailer main doc.

this is in my mailer

Simplified Version:

def ticket\_email(options)

```
msg = options[:ticket_id] ? "#{options[:message]}<br /><br

```

/\>  
Please leave the [Ref: ##{options[:ticket\_id]}] in your subject when replying, Thank you." : options[:message]

```
subject "subject"

recipients options[:recipients]||''

from options[:from]||''

cc options[:cc]||"" 

bcc options[:bcc]||""

content_type "multipart/alternative"

part :content_type => "text/plain", :body => render_message("ticket_email.text.plain.haml", :message => msg)

part :content_type => "text/html", :body => render_message("ticket_email.text.html.haml", :message => msg)

attachment :content_type => f.content_type, :body => contents, :filename => f.original_filename

```

end

Full Version (in case you wanted to take a look at it)

> def ticket\_email(options)
> 
> ```
> msg = options[:ticket_id] ? "#{options[:message]}<br /><br /><br />Please leave the [Ref: ##{options[:ticket_id]}] in your subject when replying, Thank you." : options[:message]
> 
> subject options[:subject]||'No Subject'
> recipients options[:recipients]||''
> from options[:from]||''
> cc options[:cc]||"" 
> bcc options[:bcc]||""
> 
> content_type "multipart/alternative"
> 
> part :content_type => "text/plain", :body => render_message("ticket_email.text.plain.haml", :message => msg)
> 
> part :content_type => "text/html", :body => render_message("ticket_email.text.html.haml", :message => msg)
> 
> unless options[:file].nil? or options[:file].empty?
> options[:file].each do |f|
> unless f==''
> if !f.path.nil? and !f.path.empty?
> contents = File.read(f.path)
> 
> else
> contents = f.read
> end
> attachment :content_type => f.content_type, :body => contents, :filename => f.original_filename
> end
> end
> end
> 
> ```
> 
> end Any help would be great, I have been searching for a solution for a while now.

Thanks, Matt

---

<div class="post-metadata">

**Author:** ![Walter\_McGinnis](https://avatars.discourse-cdn.com/v4/letter/w/7993a0/32.png) [@Walter\_McGinnis](https://discuss.rubyonrails.org/u/Walter_McGinnis)\
**Post date:** [September 2, 2008, 9:54pm UTC](https://discuss.rubyonrails.org/t/actionmailer-multipart-and-outlook/33919/2 "2008-09-02T21:54:55Z")

</div>

Just for some perspective… I had these same sort of problems with other web frameworks trying to send multipart mail, especially to Outlook.

I bring this up because you might find helpful information from other systems. I.e. widen your search.

Cheers,

Walter

---

<div class="post-metadata">

**Author:** ![Matt\_Simpson](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@Matt\_Simpson](https://discuss.rubyonrails.org/u/Matt_Simpson)\
**Post date:** [September 15, 2008, 6:49pm UTC](https://discuss.rubyonrails.org/t/actionmailer-multipart-and-outlook/33919/3 "2008-09-15T18:49:41Z")

</div>

Thanks for the tip, I’ve come to the realization that it is whenever I send a multipart email it is not consistently being displayed. What frameworks did you look at?

Thanks, Matt
