function email_regex()
{
$atom = "[-!#$%&'*+/=?^_`{|}~0-9A-Za-z]+";
$email_half = $atom . '(?:\\.' . $atom . ')*';
$email = $email_half . '@' . $email_half;
$email_regex = '<(' . $email . ')>';
return $email_regex;
}
function replaceEntities($matches)
{
$address = html_entity_decode($matches[1]);
$replaced = '';
for ($i = 0; $i < strlen($address); $i++) {
$char = $address[$i];
$r = rand(0, 100);
# roughly 10% raw, 45% hex, 45% dec
if ($r > 90) {
$replaced .= $char;
}
else if ($r < 45) {
$replaced .= '&#x' . dechex(ord($char)) . ';';
}
else
{
$replaced .= '&#' . ord($char) . ';';
}
}
return $replaced;
}
$output = &$modx->resource->_output;
$output = preg_replace_callback(email_regex(), "replaceEntities", $output);
$output = preg_replace_callback('/(mailto:)/', "replaceEntities", $output);This question has been answered by breezer. See the first response.

$output = $modx->documentOutput;
$output = preg_replace_callback(email_regex(), "replaceEntities", $output);
$output = preg_replace_callback('/(mailto:)/', "replaceEntities", $output);
$modx->documentOutput = $output;Is it possible to protect e-mail on your site for Evo?


