check if unique values already exists for user and Character registration and send notification mail to moderators

This commit is contained in:
coderkun 2014-04-16 13:42:19 +02:00
commit babfe5b017
11 changed files with 290 additions and 34 deletions

View file

@ -78,6 +78,35 @@
return substr($string, 0, $pos);
}
/**
* Send an email.
*
* @param string $from Sender of mail
* @param mixed $to One (string) or many (array) receivers
* @param string $subject Subject of mail
* @param string $message Message of mail
* @param boolean $html Whether mail should be formatted as HTML or not
* @return Whether mail has been send or not
*/
public static function sendMail($from, $to, $subject, $message, $html=false)
{
// Set receivers
$to = is_array($to) ? implode(',', $to) : $to;
// Set header
$headers = array();
$headers[] = 'Content-type: text/'.($html ? 'html' : 'plain').'; charset=UTF-8';
if(!is_null($from)) {
$headers[] = "From: $from";
}
$header = implode("\r\n", $headers)."\r\n";
// Send mail
return mail($to, $subject, $message, $header);
}
}
?>