# Creating html e-mails with embedded graphics

**URL:** <https://www.ruby-forum.com/t/creating-html-e-mails-with-embedded-graphics/53193>\
**Category:** Rails\
**Created:** [January 28, 2006, 1:11am UTC](https://www.ruby-forum.com/t/creating-html-e-mails-with-embedded-graphics/53193 "2006-01-28T01:11:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![errolsiegel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@errolsiegel](https://www.ruby-forum.com/u/errolsiegel)\
**Post date:** [January 28, 2006, 1:11am UTC](https://www.ruby-forum.com/t/creating-html-e-mails-with-embedded-graphics/53193/1 "2006-01-28T01:11:53Z")

</div>

I am new to RoR and I have a new project for which I’d like to use it.  
I have created a short list of the important functionality I need and it  
seems like everything is covered except one thing:

I need to generate and send mime-encoded e-mails with a plain text part,  
an HTML part with embedded graphics, and possibly an attachment.

In the old days (up until last week) I would have used some a nifty PHP  
class that I’ve used in the past to do this part. Is there some  
functionality built in to ActionMailer that handles this? If not, is  
there a plugin that adds this functionality?

Thanks,  
Errol

---

<div class="post-metadata">

**Author:** ![errolsiegel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@errolsiegel](https://www.ruby-forum.com/u/errolsiegel)\
**Post date:** [January 28, 2006, 8:27am UTC](https://www.ruby-forum.com/t/creating-html-e-mails-with-embedded-graphics/53193/2 "2006-01-28T08:27:09Z")

</div>

You can embed data in the actual url using the data: url type. Check  
out [data URI scheme - Wikipedia](http://en.wikipedia.org/wiki/Data:_URL)

---

<div class="post-metadata">

**Author:** ![errolsiegel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@errolsiegel](https://www.ruby-forum.com/u/errolsiegel)\
**Post date:** [January 28, 2006, 4:22pm UTC](https://www.ruby-forum.com/t/creating-html-e-mails-with-embedded-graphics/53193/3 "2006-01-28T16:22:18Z")

</div>

Farrel L. wrote:

> You can embed data in the actual url using the data: url type. Check  
> out [data URI scheme - Wikipedia](http://en.wikipedia.org/wiki/Data:_URL)

Thanks very much for the reference. However, after reading the  
wikipedia entry, it does not appear that this is a workable solution for  
two reasons:

1. According to the article, IE does not support this.

2. All browsers limit the size of the data. Given that a Base64 encoded  
image will be about 1/3 larger than the file size on disk, that means I  
would be limited to really small images.

I had read that ActionMailer (and the classes upon which it is based)  
provides a lot of powerful functionality. Please don’t flame me for  
saying this, but it would seem surprising to me if some basic MIME  
features like this were missing.

There are several classes for PHP that allow me to import an HTML page,  
scan it for img tags, and output MIME parts to add to the e-mail.

Does this type of functionality exist already in ActionMailer?

Thanks again,  
Errol
