HTML entities in email
Moderator: General Moderators
HTML entities in email
I'm using values entered in a form to send an email using the mail() function. When the form is posted, I apply the htmlspecialchars() function to the values. The problem comes when I send the email: The HTML entities don't get translated in the email. I've considered decoding the values before I use them in the email, but wouldn't that open me up to the security problems the encoding was meant to avoid?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: HTML entities in email
Are you sending the email in plain text or HTML format? You need a Content-Type header in your email.
Re: HTML entities in email
Plain text.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: HTML entities in email
So what do you expect to happen when you send HTML in plain text?gr8dane wrote:Plain text.
EDIT | Security issues would be eliminated if you specify the correct charset in your content-type header.
Re: HTML entities in email
You should include HTML charset in the the header