Exemple #1
0
 static function send_mail($destination, $template, $arr_vars)
 {
     $template_details = simple_select('mail_templates', 'template_name', $template, array('from_addr', 'mail_subject', 'mail_message', 'mail_html', 'mail_footer', 'template_id'), ' AND language = \'' . $_SESSION['misc']['lang'] . '\'');
     $send_text = self::substitute_variables($template_details['mail_message'], $arr_vars);
     $send_html = self::substitute_variables($template_details['mail_html'], $arr_vars);
     $headers = array('From' => $template_details['from_addr'], 'To' => $destination, 'Subject' => $template_details['mail_subject']);
     $mime = new Mail_mime("\n");
     $mime->setTXTBody($send_text);
     $mime->setHTMLBody($send_html);
     $body = $mime->get();
     $hdrs = $mime->headers($headers);
     //echo $body;
     $mail =& Mail::factory('mail');
     if ($mail->send($destination, $hdrs, $body)) {
         self::log_mail_sent($template_details['template_id'], $destination, 'system');
     } else {
         write_log_db('E-MAIL', 'ERROR-SENT', 'Dest: ' . $destination . '; template: ' . $template, 'oops_comm.php; class: mail_templates; method: send_mail');
     }
 }
Exemple #2
0
            $text = reg_insert_ko_1 . ' (' . $_POST['check_code'] . ') ' . reg_insert_ko_2 . '.<br />' . reg_insert_ko_3 . '<br />';
            $text .= '<a href="' . $conf_main_page . '?mod=' . $_GET['mod'] . '&view=' . $_GET['view'] . '&m=' . $_GET['m'] . '&code=' . $_POST['check_code'] . '&se=1">' . reg_insert_ko_4 . '</a>: ' . decode($_GET['m']);
            ?>
<script language="javascript">

document.getElementById('alerts').className = 'notice_alert';
document.getElementById('alerts').innerHTML = '<?php 
            echo $text;
            ?>
';

show_alerts_box();

</script>
			<?php 
            write_log_db('REGISTRATION', 'NEW USER KO', 'User activation code wrong: ' . $_POST['check_code'] . ' mail: ' . decode($_GET['m']), 'check_code.php');
        }
    }
}
# Send e-mail from here
if ($_GET['se']) {
    $mail = decode($_GET['m']);
    $user = new user($mail);
    if ($user->user_id) {
        $arr_code = simple_select('users', 'user_id', $user->user_id, 'control_code');
        $enc_mail = $_GET['m'];
        $arr_vars = array('check_code' => $arr_code['control_code'], 'url' => $conf_main_url . $conf_main_page . '?mod=home&view=check_code&m=' . $enc_mail, 'url_link' => $conf_main_url . $conf_main_page . '?mod=home&view=check_code&m=' . $enc_mail . '&code=' . $arr_code['control_code']);
        if ($_SERVER['SERVER_NAME'] != 'localhost') {
            mail_templates::send_mail($mail, 'check_code', $arr_vars);
        }
    }