I'm using phpmailer with the following settings:
$mail->ContentType = 'text/plain';
$mail->IsHTML(false);
...
$mail->Body = $_POST['comments'];
$mail->Body = strip_tags($mail->Body);
I noticed strip_tags() cuts off the text if it hits a single greater than / less than sign (i.e if the user put in one of those characters legitimately).
Given that I have content type = 'text/plain' and ishtml = false, is it even necessary to have strip_tags() in there?
No, it is not neccesary. If you set $mail->isHTML(false)
and you write HTML in the email, it is sent like text plain so it doesnt interpret it like HTML.
For example I've just done this:
$mail->ContentType = 'text/plain';
$mail->isHTML(false);
$mail->Subject = 'Your password';
$mail->Body = '<p>Your password is 123</p> <a href="www.google.com"> Go to google </a>';
And the mail looks like this:
<p>Your password is 123</p> <a href="wwww.google.com"> Go to google</a>