Example #1
0
function send_register_mail($mail_send_to, $filename, $modulname, $u_name, $password, $x_pos, $y_pos)
{
    global $op_admin_email, $op_set_author, $op_set_gamename, $tpl, $op_send_html_mail;
    require_once LITO_INCLUDES_PATH . 'mime_mail.class.php';
    $mime = new MIME_Mail();
    $html = "";
    $from_e = $op_admin_email;
    $from_n = $op_set_author;
    $to_e = $mail_send_to;
    $to_n = $mail_send_to;
    $text = "Registrierung bei " . $op_set_gamename;
    $filename_txt = str_replace('.html', '.txt', $filename);
    $html = $tpl->fetch(LITO_THEMES_PATH . $modulname . '/' . $filename);
    $txt = $tpl->fetch(LITO_THEMES_PATH . $modulname . '/' . $filename_txt);
    $searchReplace = array('[REG_USERNAME]' => $u_name, '[REG_PASSWORD]' => $password, '[REG_X_POS]' => $x_pos, '[REG_Y_POS]' => $y_pos, '[REG_GAME_NAME]' => $op_set_gamename);
    $html = str_replace(array_keys($searchReplace), array_values($searchReplace), $html);
    $txt = str_replace(array_keys($searchReplace), array_values($searchReplace), $txt);
    $key = "Mailer";
    $val = "Litotex mailer";
    //$mime->addXHeader( $key, $val );
    $mime->addXHeader("", "");
    $mime->addTo($to_e, $to_n);
    $mime->setFrom($from_e, $from_n);
    $mime->setSubject($text);
    $mime->setPriority(3);
    if (intval($op_send_html_mail) == 1) {
        $mime->setHTMLPart($html);
        $mime->sendMail();
    } else {
        $mime->setPlainPart($txt);
        mail($to_e, $text, $txt, "From: {$from_e}");
    }
}