# Actionmailer - Multipart and Outlook?

**URL:** <https://www.ruby-forum.com/t/actionmailer-multipart-and-outlook/147540>\
**Category:** Rails\
**Created:** [September 2, 2008, 11:32pm UTC](https://www.ruby-forum.com/t/actionmailer-multipart-and-outlook/147540 "2008-09-02T23:32:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Simpson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Matt\_Simpson](https://www.ruby-forum.com/u/Matt_Simpson)\
**Post date:** [September 2, 2008, 11:32pm UTC](https://www.ruby-forum.com/t/actionmailer-multipart-and-outlook/147540/1 "2008-09-02T23:32:16Z")

</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]}  
  
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:** ![Matt\_Simpson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Matt\_Simpson](https://www.ruby-forum.com/u/Matt_Simpson)\
**Post date:** [September 2, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/actionmailer-multipart-and-outlook/147540/2 "2008-09-02T23:55:44Z")

</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://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Matt\_Simpson](https://www.ruby-forum.com/u/Matt_Simpson)\
**Post date:** [September 15, 2008, 8:50pm UTC](https://www.ruby-forum.com/t/actionmailer-multipart-and-outlook/147540/3 "2008-09-15T20:50:52Z")

</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

On Tue, Sep 2, 2008 at 4:54 PM, Walter McGinnis
