# Actionmailler corrupting emails

**URL:** <https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357>\
**Category:** Rails\
**Created:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357 "2006-08-15T14:16:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_OSHara](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sean\_OSHara](https://www.ruby-forum.com/u/Sean_OSHara)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357/1 "2006-08-15T14:16:01Z")

</div>

Hi All,

I have a problem with actionmailer corrupting my html emails. It is  
adding the character ‘3D’ before any quotes (single or double) in my  
source and smattering ‘=’ characters throughout as well. Very  
strange. Here’s an example from one of the emails:

* * *

Thank you for order with Alien8 Recordings. Below you will find a rec= eipt for your order.

```
<h2 id=3D"h2_artist">Order 59</h2>

```

```
	=

		<div class=3D"myform" style=3D"float:right; width: 50%;">
			<h4>Shipping Info</h4>

			<div class=3D"myfield">234 6th Ave</div>
			<div class=3D"myfield">Suite 340</div>
			<div class=3D"myfield">New York</div>
			<div class=3D"myfield"></div>
			<div class=3D"myfield">10010</div>
			<div class=3D"myfield">United States</div>
		</div>
	=

	=

```

* * *

Any ideas what could be causing this? Someone on irc mentioned an  
issue with ruby cgi library, but wasn’t sure how to fix it. My code  
is below.

Thanks in advance,  
Sean

Here’s my code:

# development.rb

# Smtp config

ActionMailer::Base.server\_settings = {  
:address =\> “smtp.b2b2c.ca”,  
:port =\> 25,  
:domain =\> ‘[www.mywebsite.com](http://www.mywebsite.com)’  
}  
ActionMailer::Base.default\_charset = “utf-8”

# notfier.rb

class Notifier \< ActionMailer::Base

def order\_confirmation(order)  
@recipients = order.customer.email  
@from = “removed\_email\_address@domain.invalid”  
@subject = “Alien8 Recordings Store Order Confirmation Number #  
{order.id}”  
@body[“order”] = order  
end

end

# order\_confirmation.text.html.rhtml

Thank you for order with Alien8 Recordings. Below you will find a receipt for your order.

```
<%= render :partial => '../admin/orders/order_display' %>

```

---

<div class="post-metadata">

**Author:** ![Sean\_OSHara](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sean\_OSHara](https://www.ruby-forum.com/u/Sean_OSHara)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357/2 "2006-08-15T14:17:34Z")

</div>

I’m still trying to figure this one out… someone on IRC suggested  
it’s a utf8 issue, however I testing sending some chinese characters  
and they were rendered fine. It’s the = symbol only that is being  
rendered as =3D… any ideas?

Thanks,  
Sean

On 10-Aug-06, at 8:41 PM, Sean O’Hara wrote:

> = 
> Thanks in advance, :domain =\> 'www.mywebsite.com' {order.id}" charset=utf-8" /\>
> 
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

ALIEN8 RECORDINGS  
P.O. BOX 666, STATION R  
MONTREAL, QC  
CANADA, H2S 3L1

[http://www.alien8recordings.com](http://www.alien8recordings.com)

---

<div class="post-metadata">

**Author:** ![Sean\_OSHara](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sean\_OSHara](https://www.ruby-forum.com/u/Sean_OSHara)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357/3 "2006-08-15T14:18:50Z")

</div>

Has no one experienced such a problem before? I’m really at a loss  
as to what is causing it.

Thanks,  
Sean

On 10-Aug-06, at 8:41 PM, Sean O’Hara wrote:

> = 
> Thanks in advance, :domain =\> 'www.mywebsite.com' {order.id}" charset=utf-8" /\>
> 
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

ALIEN8 RECORDINGS  
P.O. BOX 666, STATION R  
MONTREAL, QC  
CANADA, H2S 3L1

[http://www.alien8recordings.com](http://www.alien8recordings.com)

---

<div class="post-metadata">

**Author:** ![Sean\_OSHara](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sean\_OSHara](https://www.ruby-forum.com/u/Sean_OSHara)\
**Post date:** [September 4, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357/4 "2006-09-04T14:45:25Z")

</div>

I am having the same problem -

It looks like an encoding issue (0x3D is the equal sign) - likely a  
mis-placed regex.

I’ve been caught-up on other bigger-problems, but I suspect we’re  
looking at a bug. grin. I didn’t find a ticket post btw.

Jodi

---

<div class="post-metadata">

**Author:** ![Sean\_OSHara](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dbc845/32.png) [@Sean\_OSHara](https://www.ruby-forum.com/u/Sean_OSHara)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/actionmailler-corrupting-emails/102357/5 "2006-08-15T14:17:42Z")

</div>

Alien8 Recordings wrote:

> I’m still trying to figure this one out… someone on IRC suggested  
> it’s  
> a utf8 issue, however I testing sending some chinese characters and  
> they  
> were rendered fine. It’s the = symbol only that is being rendered as  
> =3D… any ideas?

That could have been me on IRC. Upon further thinking, the pattern  
isn’t UTF-8 but Quoted-Printable (QP) MIME encoding.

QP escapes non-ascii-7 characters using = (equal sign), so any literal  
‘=’ in your string will have to be escaped to ‘=3D’ (the QP escaped-hex  
encoding of ‘=’).

Actionmailer isn’t corrupting your email, it’s properly encoding to  
conservatively pass the message through all the transport agents that  
may handle it.

It should be properly setting a mime-type so the end point knows to  
interpret the text as Quoted-Printable. If you’re seeing literal ‘=3D’  
at the end point, either some encoding header has been lost or the end  
client is incorrectly rendering the mime-type.

For a tutorial on character encoding issues, see  
[http://www.cs.tut.fi/~jkorpela/chars.html](http://www.cs.tut.fi/~jkorpela/chars.html)

–  
Devin Ben-Hur 503/860-4114 [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

You may not have noticed, but we live in one of the safest,  
most peaceful, times in human history. In the US, the three  
leading causes of death are: killing yourself, killing yourself,  
and killing yourself [http://tinyurl.com/msxhq](http://tinyurl.com/msxhq).

–  
No virus found in this outgoing message.  
Checked by AVG Free Edition.  
Version: 7.1.405 / Virus Database: 268.10.9/417 - Release Date:  
8/11/2006
