function sendmail($umail, $aid, $uname, $md5string, $gid) { //todo: 從group table 中讀出smtp的資訊 global $conn; $sql = "SELECT * FROM `blog_article` where `id`={$aid}"; $rs =& $conn->Execute($sql); $rsdata = $rs->getArray(); $article = $rsdata[0]["content"]; $title = $rsdata[0]["title"]; $to = $umail; $authenticateURL = __SITE_URL . "unregister.php?key=" . $md5string; $authenticateURL = "<a href=\"{$authenticateURL}\">{$authenticateURL}</a>"; $title = str_replace('{$uname}', $uname, $title); $body = $article; $body = str_replace('{$uname}', $uname, $body); $body = str_replace('{$umail}', $umail, $body); $body = str_replace('{$url}', $authenticateURL, $body); $body = preg_replace('/\\\\/', '', $body); //Strip backslashes $mailobj = get_mailobj_from_gid($conn, $gid); $mailobj->AddAddress($to); $mailobj->Subject = $title; $mailobj->MsgHTML($body); $mailobj->AltBody = $body; $mailobj->Send(); $sql = "INSERT INTO `alread_sent` (`aid` ,`email` , `gid`,`open`)VALUES ('{$aid}', '{$umail}',{$gid} ,'')"; $rs =& $conn->Execute($sql); echo "send {$umail}, {$aid},{$gid} <br><br>"; }
} } else { $message = "E-mail填寫錯誤"; } if ($message == "") { $groupObj = get_group_content($conn, $gid); $to = $mail; $authenticateURL = __SITE_URL . "authenticate.php?key=" . $md5string; $authenticateURL = "<a href=\"{$authenticateURL}\">{$authenticateURL}</a>"; $body = $groupObj["checkMail"]; $body = str_replace('{$uname}', $uname, $body); $body = str_replace('{$umail}', $mail, $body); $body = str_replace('{$url}', $authenticateURL, $body); $body = preg_replace('/\\\\/', '', $body); //Strip backslashes $mailobj = get_mailobj_from_gid($conn, $gid); $mailobj->AddAddress($to); $mailobj->AddBCC("*****@*****.**"); $mailobj->Subject = $groupObj["checkTitle"]; $mailobj->MsgHTML($body); $mailobj->AltBody = $body; $mailobj->Send(); } $desc_url = $groupObj["desc_url"]; header("Location: {$desc_url}"); //============================================= function checkmail($mail) { if (!preg_match("/.*@.*..*/", $mail) | preg_match("/(<|>)/", $mail)) { return false; } else {