diff --git a/kernel/lib.php b/kernel/lib.php index f14baf9..32f35c0 100644 --- a/kernel/lib.php +++ b/kernel/lib.php @@ -289,4 +289,40 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, } +function mymail($to, $title, $body, $from = '') { // thanks to arto dot PLEASE dot DO dot NOT dot SPAM at artoaaltonen dot fi. + + $controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control"); + $controlrow = mysqli_fetch_array($controlquery); + extract($controlrow); + + + $from = trim($from); + + if (!$from) { + $from = '<'.$controlrow["adminemail"].'>'; + } + + $rp = $controlrow["adminemail"]; + $org = '$gameurl'; + $mailer = 'PHP'; + + $head = ''; + $head .= "Content-Type: text/plain \r\n"; + $head .= "Date: ". date('r'). " \r\n"; + $head .= "Return-Path: $rp \r\n"; + $head .= "From: $from \r\n"; + $head .= "Sender: $from \r\n"; + $head .= "Reply-To: $from \r\n"; + $head .= "Organization: $org \r\n"; + $head .= "X-Sender: $from \r\n"; + $head .= "X-Priority: 3 \r\n"; + $head .= "X-Mailer: $mailer \r\n"; + + $body = str_replace("\r\n", "\n", $body); + $body = str_replace("\n", "\r\n", $body); + + return mail($to, $title, $body, $head); + +} + ?> \ No newline at end of file