<?php

die('remove this');
//test script for class_email
require 'SendEmail.php';
//require 'class_email-small.php';
$e = new SendEmail();
$e->set_server('mail.local', 25);
//$e->set_server( 'smtp.gmail.com', 587);
$e->set_auth('your smtp username', 'your smtp password');
$e->set_sender('Name of sender', '*****@*****.**');
$e->set_hostname('some servers require a valid rdns name');
//$e->set_debug(true);
//$e->set_crypto('ssl');
//$e->set_smtp_try(false);
$subject = 'This is a text subject Ää, Öö, Üü';
$body = "This is the test body of the message\r\nIt may contain special characters: Ää, Öö, Üü\r\n";
//$e->set_type(0);
/* send e-mail right away */
$e->mail('*****@*****.**', $subject, $body);
echo 'last: ' . $e->srv_ret['last'] . "\n";
echo 'all: ' . $e->srv_ret['all'] . "\n";
echo 'full' . $e->srv_ret['full'] . "\n";
/* or add the message to the queue table to be processed by smtp_queue_processor.php
 *  Please see "smtp_queue_processor.php" for the required table structure
 */
//  $conn = mysqli_connect();
//  mysqli_set_charset( $conn, 'utf8');
//  $e->queue( '*****@*****.**', $subject, $body, null, $conn);
//
//  Under Windows - also update paths in run_windows.bat
$debug = false;
//<!--BUILD_SCRIPT_OPTION_CONFIG_STRING-->
/* script starts here */
$PID = rand_string(20);
//unique by chance :)
$CONFIG['SMTP_PROCESS_BATCH'] = is_int($CONFIG['SMTP_PROCESS_BATCH']) === true && $CONFIG['SMTP_PROCESS_BATCH'] > 0 ? $CONFIG['SMTP_PROCESS_BATCH'] : 1;
$CONFIG['SMTP_CLEAR_SUCCESS'] = is_bool($CONFIG['SMTP_CLEAR_SUCCESS']) === true && $CONFIG['SMTP_CLEAR_SUCCESS'] === true ? true : false;
//Check when the queue was last processed and die() if too soon
process_lockfile($CONFIG['SMTP_QUEUE_DIFF'], $PID);
/* setup e-mail object */
require_once 'SendEmail.php';
$e = new SendEmail();
$e->set_hostname($CONFIG['WEBSERVER_RDNS']);
// rDNS name of your server - php_uname('n') is only guess
$e->set_server($CONFIG['SMTP_SERVER'], $CONFIG['SMTP_PORT']);
$e->set_auth($CONFIG['SMTP_USER'], $CONFIG['SMTP_PASSWORD']);
$e->set_sender($CONFIG['SMTP_FROM'], $CONFIG['SMTP_FROM_EMAIL']);
//this is the FROM: info of the email
$e->set_crypto($CONFIG['SMTP_CRYPTO']);
// starttls , tls ,  ssl or none
if ($CONFIG['SMTP_PASSWORD'] == 12345) {
    echo "1,2,3,4,5? .... That's amazing! I've got the same combination on my luggage!\n";
}
/* connect to database */
$conn = @mysqli_connect($CONFIG['DB_SERVER'], $CONFIG['DB_USER'], $CONFIG['DB_PASSWORD'], $CONFIG['DB_NAME']);
if (!$conn) {
    $msg = "Unable to connect with MySQL server\n" . "Error reported by mySQL: " . mysqli_connect_error();
    throw new Exception($msg);
}
if (!mysqli_set_charset($conn, 'utf8')) {
    $msg = "Failed to set charset to utf8!\n" . "Error reported by mySQL: " . mysqli_error($conn);