$from = 'no-reply@'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8');
Especially what's ENT_COMPAT for?
Anyone knows?
$from = 'no-reply@'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8');
Especially what's ENT_COMPAT for?
Anyone knows?
forming a email address, quite stupid way
For the answer to the question Especially what's ENT_COMPAT for? you can browse PHP documentation for the htmlspecialchars, because it's this function's parameter
htmlspecialchars encodes all characters than can be encoded as entities. This is especially important for angle brackets and ampersands. ENT_COMPAT will leave single quotes in place and only convert double quotes. 'UTF-8' will treat the input as UTF-8 encoded (instead of the default iso-latin1 encoding).
In this case, the htmlspecialchars makes only sense if the mail address will be put into a "mailto:" href attribute. Normal server names don't have characters that must be encoded, so I'm not sure if htmlspecialchars is needed.
Creating a valid looking email semi-auotmatic. The email username is 'no-reply' and the domain is whatever the servers hostname is. With a 'no-reply' the recipient usually does not reply to these emails.
ENT_COMPAT is explained here: http://php.net/manual/en/function.htmlspecialchars.php