# &quot; appearing in email

**URL:** <https://www.ruby-forum.com/t/quot-appearing-in-email/182925>\
**Category:** Rails\
**Created:** [February 4, 2010, 9:48pm UTC](https://www.ruby-forum.com/t/quot-appearing-in-email/182925 "2010-02-04T21:48:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [February 4, 2010, 9:48pm UTC](https://www.ruby-forum.com/t/quot-appearing-in-email/182925/1 "2010-02-04T21:48:06Z")

</div>

I am having problems with the formatting of my email.  
This is what my code looks like

* * *

```
  email =

```

## NotifyMailer.create\_send\_notifications(@notification,@test) email.set\_content\_type(“text/plain”) NotifyMailer.deliver(email)

and my send\_notifications.rhtml looks like this

* * *

## \<%=h @notification.message %\>

When I send an email with quotes, for example ( test “message”) my email  
looks like this

test "message&quot

I am running rails 1.2.3. Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [February 4, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/quot-appearing-in-email/182925/2 "2010-02-04T22:13:20Z")

</div>

On Feb 4, 2010, at 12:48 PM, Jay D. wrote:

> and my send\_notifications.rhtml looks like this
> 
> * * *
> 
> \<%=h @notification.message %\>

Don’t escape it. h is an alias for html\_escape which (for 2.3.2) does  
this on the argument:

to\_s.gsub(/[&"\>\<]/) { |special| HTML\_ESCAPE[special] }

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [February 4, 2010, 10:16pm UTC](https://www.ruby-forum.com/t/quot-appearing-in-email/182925/3 "2010-02-04T22:16:16Z")

</div>

On Feb 4, 9:11 pm, Philip H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > \<%=h @notification.message %\>
> 
> Don’t escape it. h is an alias for html\_escape which (for 2.3.2) does  
> this on the argument:

To be quite precise, only use h (that is, html\_escape) if the output  
is html. While your template is a .rhtml, you are telling mail clients  
that you are sending plain text.

Fred

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [February 5, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/quot-appearing-in-email/182925/4 "2010-02-05T16:22:35Z")

</div>

Frederick C. wrote:

> On Feb 4, 9:11ï¿½pm, Philip H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > \<%=h @notification.message %\>
> > 
> > Don’t escape it. ï¿½h is an alias for html\_escape which (for 2.3.2) does ï¿½  
> > this on the argument:
> 
> To be quite precise, only use h (that is, html\_escape) if the output  
> is html. While your template is a .rhtml, you are telling mail clients  
> that you are sending plain text.
> 
> Fred

Great! that worked.  
Thanks!
