Reputation: 11
I am using PHPMailer class to send mails. Some mails contain user input. Should I clean user input before inserting it to mail body
? How to do this?
Tried to google for it but haven't fount anything useful.
Upvotes: 1
Views: 542
Reputation: 22947
Sanitation is always key when handling user input.
strip_tags
to limit the HTML tags they're allowed to use, if any.htmlspecialchars
will properly change things like <
into <
so they can't be evaluated as HTML.pg_escape_string
mysql_real_escape_string
Upvotes: 0
Reputation: 5974
Yes, you should ALWAYS
sanitize/clean user input to prevent code or SQL injections.
Upvotes: 3