I could not add a comment to Mohammad Sakib, but I wanted to say that you should not use <br> as a substitute for \r\n , because this can lead to the message being caught by the "too long line" spam -filters. New lines are important to keep emails more humane and ensure successful delivery!
My recommended method:
$output[] = "line 1"; $output[] = "line 2"; $EmailBody = join("\r\n",$output);
You should also make sure that you "sanitize" the headers to avoid typing the header from user input, here is a function that usually does not stop the injection:
function sanitize(&$data){ return str_ireplace(array("\r", "\n", "%0a", "%0d"), '', stripslashes($data)); } $headers = 'From: '.sanitize($email);
If you want the HTML tags to appear in the message, change the type using the header:
$headers = 'Content-type: text/html;\r\nFrom: '.sanitize($email);
If you were displaying HTML, you should clear the user input to avoid something unexpected ... i.e. HTML insertions. Use this function wherever you display user input in HTML:
function htmlclean($str){ return htmlentities($str, ENT_QUOTES); }
eg. $ body = "Brand Name:". htmlclean ($ branded);
source share