本文整理汇总了PHP中smtp::quit方法的典型用法代码示例。如果您正苦于以下问题:PHP smtp::quit方法的具体用法?PHP smtp::quit怎么用?PHP smtp::quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtp
的用法示例。
在下文中一共展示了smtp::quit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wifidog_register_perform
//.........这里部分代码省略.........
$array["LOGIN"] = $email;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["token"] = $token;
$array["HOST"] = $_REQUEST["ip"];
UnLock($array);
ToSyslog("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
ToSyslog("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
return;
}
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm={$sessionkey}";
$smtp_sender = $ArticaHotSpotSMTP["smtp_sender"];
if ($ArticaHotSpotSMTP["REGISTER_MESSAGE"] == null) {
$ArticaHotSpotSMTP["REGISTER_MESSAGE"] = "Hi, in order to activate your account on the HotSpot system,\nclick on the link below";
}
if ($ArticaHotSpotSMTP["RECOVER_MESSAGE"] == null) {
$ArticaHotSpotSMTP["RECOVER_MESSAGE"] = "Hi, in order to recover your password on the HotSpot system,\nclick on the link below";
}
if ($ArticaHotSpotSMTP["CONFIRM_MESSAGE"] == null) {
$ArticaHotSpotSMTP["CONFIRM_MESSAGE"] = "Success\nA message as been sent to you.\nPlease check your WebMail system in order to confirm your registration";
}
if ($ArticaHotSpotSMTP["REGISTER_SUBJECT"] == null) {
$ArticaHotSpotSMTP["REGISTER_SUBJECT"] = "HotSpot account validation";
}
$smtp_senderTR = explode("@", $smtp_sender);
$instance = $smtp_senderTR[1];
$random_hash = md5(date('r', time()));
$boundary = "{$random_hash}/{$instance}";
$body[] = "Return-Path: <{$smtp_sender}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$smtp_sender}";
$body[] = "Subject: {$ArticaHotSpotSMTP["REGISTER_SUBJECT"]}";
$body[] = "To: {$email}";
$body[] = "Auto-Submitted: auto-replied";
$body[] = "MIME-Version: 1.0";
$body[] = "Content-Type: multipart/mixed;";
$body[] = "\tboundary=\"{$boundary}\"";
$body[] = "Content-Transfer-Encoding: 8bit";
$body[] = "Message-Id: <{$random_hash}@{$instance}>";
$body[] = "--{$boundary}";
$body[] = "Content-Description: Notification";
$body[] = "Content-Type: text/plain; charset=us-ascii";
$body[] = "";
$body[] = $ArticaHotSpotSMTP["REGISTER_MESSAGE"];
$body[] = $URL_REDIRECT;
$body[] = "";
$body[] = "";
$body[] = "--{$boundary}";
$finalbody = @implode("\r\n", $body);
$smtp = new smtp();
if ($ArticaHotSpotSMTP["smtp_auth_user"] != null) {
$params["auth"] = true;
$params["user"] = $ArticaHotSpotSMTP["smtp_auth_user"];
$params["pass"] = $ArticaHotSpotSMTP["smtp_auth_passwd"];
}
$params["host"] = $ArticaHotSpotSMTP["smtp_server_name"];
$params["port"] = $ArticaHotSpotSMTP["smtp_server_port"];
if (!$smtp->connect($params)) {
return wifidog_register("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $email, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
return wifidog_register("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
ToSyslog("From: {$smtp_sender} to {$email} {$ArticaHotSpotSMTP["REGISTER_SUBJECT"]} success");
}
$smtp->quit();
if ($GLOBALS["HOTSPOT_DEBUG"]) {
ToSyslog("wifidog_auth/" . __FUNCTION__ . ":: Token: {$token} -> UnLock(..");
}
$array["LOGIN"] = $email;
$array["ARP"] = $_REQUEST["mac"];
$array["token"] = $token;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["REGISTER"] = true;
if (!UnLock($array)) {
if ($GLOBALS["HOTSPOT_DEBUG"]) {
ToSyslog("wifidog_auth/" . __FUNCTION__ . "::failed_to_create_session");
}
return wifidog_register("{error} {failed_to_create_session}");
}
ToSyslog("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
ToSyslog("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
}
示例2: testmail
function testmail()
{
$sock = new sockets();
$HotSpotAutoRegisterWebMail = intval($sock->GET_INFO("HotSpotAutoRegisterWebMail"));
$HotSpotAutoRegisterSMTPSrv = $sock->GET_INFO("HotSpotAutoRegisterSMTPSrv");
$HotSpotAutoRegisterSMTPSrvPort = $sock->GET_INFO("HotSpotAutoRegisterSMTPSrvPort");
$HotSpotAutoRegisterSMTPSender = $sock->GET_INFO("HotSpotAutoRegisterSMTPSender");
$HotSpotAutoRegisterSMTPUser = $sock->GET_INFO("HotSpotAutoRegisterSMTPUser");
$HotSpotAutoRegisterSMTPPass = $sock->GET_INFO("HotSpotAutoRegisterSMTPPass");
$HotSpotAutoRegisterSMTPTls = intval($sock->GET_INFO("HotSpotAutoRegisterSMTPTls"));
$HotSpotAutoRegisterSMTPSSL = intval($sock->GET_INFO("HotSpotAutoRegisterSMTPSSL"));
$instance = trim($sock->getFrameWork('cmd.php?full-hostname=yes'));
if ($HotSpotAutoRegisterSMTPSrvPort == 0) {
$HotSpotAutoRegisterSMTPSrvPort = 25;
}
$smtp = new smtp();
if ($HotSpotAutoRegisterSMTPUser != null) {
$params["auth"] = true;
$params["user"] = $HotSpotAutoRegisterSMTPUser;
$params["pass"] = $HotSpotAutoRegisterSMTPPass;
}
$params["host"] = $HotSpotAutoRegisterSMTPSrv;
$params["port"] = $HotSpotAutoRegisterSMTPSrvPort;
if (!$smtp->connect($params)) {
echo "Error {$smtp->error_number}: Could not connect to `{$HotSpotAutoRegisterSMTPSrv}` {$smtp->error_text}\n";
return;
}
echo "Connecting OK\n";
$random_hash = md5(date('r', time()));
$boundary = "{$random_hash}/{$instance}";
$body[] = "Return-Path: <{$HotSpotAutoRegisterSMTPSender}>";
$body[] = "X-Original-To: {$recipient}";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$HotSpotAutoRegisterSMTPSender} (Mail Delivery System)";
$body[] = "Subject: {$Subject}";
$body[] = "To: {$recipient}";
$body[] = "";
$body[] = "";
$body[] = "This is the mail system at host {$instance}.";
$body[] = "";
$body[] = "I'm glade to inform you that your message is";
$body[] = " delivered to you...";
$body[] = "";
$body[] = "For further assistance, please send mail to postmaster.";
$body[] = "";
$body[] = "If you do so, please include this problem report. You can";
$body[] = "delete your own text from the attached returned message.";
$body[] = "";
$body[] = " The mail system";
$body[] = "";
$body[] = "";
$finalbody = @implode("\r\n", $body);
if (!$smtp->send(array("from" => $HotSpotAutoRegisterSMTPSender, "recipients" => $recipient, "body" => $finalbody, "headers" => null))) {
echo "Error {$smtp->error_number}: Could not send to `{$HotSpotAutoRegisterSMTPSrv}` {$smtp->error_text}\n";
$smtp->quit();
return;
}
$smtp->quit();
return;
}
示例3: start
function start($id)
{
$GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/mimedefang.resend.progress.{$id}";
$id = intval($id);
$sock = new sockets();
$unix = new unix();
if ($id == 0) {
echo "ID: {$id} not supported\n";
build_progress(110, "{failed}");
die;
}
$postgres = new postgres_sql();
$tempfile = $unix->FILE_TEMP();
$Dirtemp = $unix->TEMP_DIR();
$q = new postgres_sql();
$ligne = pg_fetch_array($q->QUERY_SQL("SELECT * FROM quarmsg WHERE id='{$id}'"));
if (!$q->ok) {
echo "PostgreSQL Error:" . $q->mysql_error . "\n";
build_progress(110, "PostgreSQL {failed}");
die;
}
$instance = $unix->hostname_g();
$mailfrom = $ligne["mailfrom"];
$mailto = $ligne["mailto"];
$msgmd5 = $ligne["msgmd5"];
if ($mailfrom == null) {
$mailfrom = "root@{$instance}";
}
echo "From: {$mailfrom}\n";
echo "To..: {$mailto}\n";
echo "ID..: {$msgmd5}\n";
build_progress(20, "{$mailfrom} {to} {$mailto} ({$msgmd5})");
$sql = "SELECT contentid FROM quardata WHERE msgmd5='{$msgmd5}'";
$ligne = pg_fetch_array($q->QUERY_SQL($sql));
if (!$q->ok) {
echo "PostgreSQL Error:" . $q->mysql_error . "\n";
build_progress(110, "PostgreSQL {failed}");
die;
}
$contentid = $ligne["contentid"];
build_progress(30, "msg id: {$contentid}");
@mkdir($Dirtemp, 0777, true);
@chmod($Dirtemp, 0777);
$sql = "select lo_export({$contentid}, '{$Dirtemp}/{$msgmd5}.gz')";
if ($GLOBALS["VERBOSE"]) {
echo "<hr>{$sql}<br>\n";
}
$q->QUERY_SQL($sql);
if (!$q->ok) {
echo "PostgreSQL Error:" . $q->mysql_error . "\n";
build_progress(110, "PostgreSQL {failed}");
die;
}
build_progress(40, "{uncompress}");
if (!$unix->uncompress("{$Dirtemp}/{$msgmd5}.gz", "{$Dirtemp}/{$msgmd5}.msg")) {
@unlink("{$Dirtemp}/{$msgmd5}.gz");
@unlink("{$Dirtemp}/{$msgmd5}.msg");
build_progress(110, "{uncompress} {failed}");
die;
}
$smtp = new smtp();
$TargetHostname = inet_interfaces();
if (preg_match("#all#is", $TargetHostname)) {
$TargetHostname = "127.0.0.1";
}
$params["helo"] = $instance;
$params["debug"] = true;
$params["host"] = $TargetHostname;
$params["bindto"] = "127.0.0.1";
build_progress(50, "{connecting}");
if (!$smtp->connect($params)) {
build_progress(110, "{connect} {failed}");
@unlink("{$Dirtemp}/{$msgmd5}.msg");
echo "{$smtp->error_number}: Could not connect to `{$TargetHostname}` {$smtp->error_text}\n";
return;
}
$finalbody = @file_get_contents("{$Dirtemp}/{$msgmd5}.msg");
build_progress(90, "{sending}");
if (!$smtp->send(array("from" => $mailfrom, "recipients" => $mailto, "body" => $finalbody, "headers" => null))) {
build_progress(110, "{sending} {failed}");
@unlink("{$Dirtemp}/{$msgmd5}.msg");
echo "{$smtp->error_number}: Could not connect to `{$TargetHostname}` {$smtp->error_text}\n";
$smtp->quit();
return;
}
@unlink("{$Dirtemp}/{$msgmd5}.msg");
$smtp->quit();
build_progress(100, "{success}");
}
示例4: wifidog_register_perform
//.........这里部分代码省略.........
}
if ($ENABLED_SMTP == 0) {
$autocreate_confirmed = 1;
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("Create new member {$email},{$password},TTL:{$ArticaSplashHotSpotEndTime}", __FUNCTION__, __LINE__);
}
$sql = "INSERT IGNORE INTO hotspot_members \n\t(uid,username,token,ruleid,ttl,sessiontime,password,enabled,creationtime,autocreate,autocreate_confirmed,autocreate_maxttl,sessionkey,MAC) VALUES\n\t('{$email}','{$email}','{$token}','{$_SESSION["WIFIDOG_RULES"]}','{$ArticaSplashHotSpotEndTime}','','{$password}',1,'{$creationtime}',1,'{$autocreate_confirmed}',{$autocreate_maxttl},'{$sessionkey}','{$MAC}')";
$q->QUERY_SQL($sql);
wifidog_logs("[{$ARP}]:[{$GLOBALS["CONNECTED_IP"]}]: {$email}: Create New member with a token {$token}", __FUNCTION__, __LINE__);
if (!$q->ok) {
events(0, "MySQL error: {$q->mysql_error} (Line: " . __LINE__ . ")");
wifidog_logs("{$q->mysql_error}");
wifidog_logs("{$sql}");
return wifidog_register($q->mysql_error);
}
if ($ENABLED_SMTP == 0) {
$array["SERVER_NAME"] = $_SERVER["SERVER_NAME"];
$array["redirecturi"] = $url;
$array["LOGIN"] = $email;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["token"] = $token;
$array["HOST"] = $_REQUEST["ip"];
$array["ruleid"] = $_SESSION["WIFIDOG_RULES"];
UnLock($array);
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
return;
}
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm={$sessionkey}";
$smtp_sender = $sock->GET_INFO("smtp_sender");
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
$message = new Mail_mime("\r\n");
$text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p>\n\t<p>\t\n\t<hr>\n\t\t<center>\n\t\t\t<a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a>\n\t\t</center>\n\t</p>";
$message->setFrom($smtp_sender);
$message->addTo($email);
$message->setSubject($wifidog_templates->REGISTER_SUBJECT);
$message->setTXTBody(strip_tags($text));
$message->setHTMLBody($text);
$finalbody = $message->getMessage();
$webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $email);
if (!$webauth_msmtp->Send()) {
events(0, "SMTP Error[method 1]: {$webauth_msmtp->logs}", $webauth_msmtp->logs);
$content[] = "Method 1:\n{$webauth_msmtp->logs}\n";
$smtp = new smtp();
if ($sock->GET_INFO("smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("smtp_auth_user");
$params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("smtp_server_name");
$params["port"] = $sock->GET_INFO("smtp_server_port");
if (!$smtp->connect($params)) {
$content[] = "Method2 Error:{$smtp->error_number} {$smtp->error_text}";
events(0, "SMTP Error[method 2 - Connect]: {$params["host"]} {$smtp->error_number} {$smtp->error_text}", @implode("\n", $content));
return wifidog_register("{$email}: {error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $email, "body" => $finalbody, "headers" => null))) {
events(0, "SMTP Error[method 2 - Send]: {$smtp->error_number} {$smtp->error_text}", null);
$smtp->quit();
return wifidog_register("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("From: {$smtp_sender} to {$email} {$wifidog_templates->REGISTER_SUBJECT} success");
}
$smtp->quit();
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Token: {$token} -> UnLock(..");
}
$array["LOGIN"] = $email;
$array["ARP"] = $_REQUEST["mac"];
$array["token"] = $token;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["REGISTER"] = true;
if (!UnLock($array)) {
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("wifidog_auth/" . __FUNCTION__ . "::failed_to_create_session");
}
return wifidog_register("{error} {failed_to_create_session}");
}
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
}
示例5: tests_smtp
function tests_smtp()
{
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('error_prepend_string', null);
ini_set('error_append_string', null);
$tpl = new templates();
$sock = new sockets();
$sock = new wifidog_settings($_POST["ruleid"]);
$mobile = $_POST["mobile"];
$CODE_NUMBER = "1234";
$wifidog_templates = new wifidog_templates($_POST["ruleid"]);
$wifidog_templates->SMS_SMTP_SUBJECT = str_replace("%MOBILE%", $mobile, $wifidog_templates->SMS_SMTP_SUBJECT);
$wifidog_templates->SMS_SMTP_SUBJECT = str_replace("%CODE%", $CODE_NUMBER, $wifidog_templates->SMS_SMTP_SUBJECT);
$wifidog_templates->SMS_SMTP_SUBJECT = str_replace("%TIME%", time(), $wifidog_templates->SMS_SMTP_SUBJECT);
$wifidog_templates->SMS_SMTP_BODY = str_replace("%MOBILE%", $mobile, $wifidog_templates->SMS_SMTP_BODY);
$wifidog_templates->SMS_SMTP_BODY = str_replace("%CODE%", $CODE_NUMBER, $wifidog_templates->SMS_SMTP_BODY);
$wifidog_templates->SMS_SMTP_BODY = str_replace("%TIME%", time(), $wifidog_templates->SMS_SMTP_BODY);
$wifidog_templates->SMS_SMTP_BODY = str_replace("\n", "\r\n", $wifidog_templates->SMS_SMTP_BODY);
echo "Rule: {$_POST["ruleid"]}\n";
$smtp_sender = $sock->GET_INFO("sms_smtp_sender");
$smtp_senderTR = explode("@", $smtp_sender);
$instance = $smtp_senderTR[1];
$sms_smtp_recipient = $sock->GET_INFO("sms_smtp_recipient");
$random_hash = md5(date('r', time()));
$boundary = "{$random_hash}/{$instance}";
$body[] = "Return-Path: <{$smtp_sender}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$smtp_sender}";
$body[] = "Subject: {$wifidog_templates->SMS_SMTP_SUBJECT}";
$body[] = "To: {$sms_smtp_recipient}";
$body[] = "Auto-Submitted: auto-replied";
$body[] = "MIME-Version: 1.0";
$body[] = "Content-Type: multipart/mixed;";
$body[] = "\tboundary=\"{$boundary}\"";
$body[] = "Content-Transfer-Encoding: 8bit";
$body[] = "Message-Id: <{$random_hash}@{$instance}>";
$body[] = "--{$boundary}";
$body[] = "Content-Description: Notification";
$body[] = "Content-Type: text/plain; charset=us-ascii";
$body[] = "";
$body[] = $wifidog_templates->SMS_SMTP_BODY;
$body[] = "";
$body[] = "";
$body[] = "--{$boundary}";
$finalbody = @implode("\r\n", $body);
include_once dirname(__FILE__) . "/ressources/class.webauth-sms-msmtp.inc";
$webauth_msmtp = new webauth_sms_msmtp($finalbody, $_POST["ruleid"]);
if ($webauth_msmtp->Send()) {
echo $tpl->javascript_parse_text("{$wifidog_templates->SMS_SMTP_SUBJECT}\nTo {$sms_smtp_recipient}: {success}", 1);
return;
}
$smtp = new smtp();
if ($sock->GET_INFO("sms_smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("sms_smtp_auth_user");
$params["pass"] = $sock->GET_INFO("sms_smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("sms_smtp_server_name");
$params["port"] = $sock->GET_INFO("sms_smtp_server_port");
if (!$smtp->connect($params)) {
echo $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}", 1);
return;
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $sms_smtp_recipient, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
echo $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}", 1);
return;
}
echo $tpl->javascript_parse_text("{$wifidog_templates->SMS_SMTP_SUBJECT}\nTo {$sms_smtp_recipient}: {success}", 1);
$smtp->quit();
}
示例6: sendEmail
function sendEmail($subject, $content = null)
{
$unix = new unix();
$hostname = "ks220503.kimsufi.com";
$mailfrom = "root@{$hostname}";
$recipient = "david@articatech.com";
$TargetHostname = "37.187.142.164";
$params["helo"] = $hostname;
$params["host"] = $TargetHostname;
$params["do_debug"] = true;
$params["debug"] = true;
$smtp = new smtp($params);
if (!$smtp->connect($params)) {
smtp::events("Error {$smtp->error_number}: Could not connect to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
return;
}
$random_hash = md5(date('r', time()));
$content = str_replace("\r\n", "\n", $content);
$content = str_replace("\n", "\r\n", $content);
$body[] = "Return-Path: <{$mailfrom}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$mailfrom} (robot)";
$body[] = "Subject: {$subject}";
$body[] = "To: {$recipient}";
$body[] = "";
$body[] = "";
$body[] = $content;
$body[] = "";
$finalbody = @implode("\r\n", $body);
if (!$smtp->send(array("from" => "{$mailfrom}", "recipients" => $recipient, "body" => $finalbody, "headers" => null))) {
smtp::events("Error {$smtp->error_number}: Could not send to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
return;
}
smtp::events("Success sending message trough [{$TargetHostname}:25]", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
}
示例7: tests_smtp
function tests_smtp()
{
//ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
header("content-type: application/x-javascript");
$sock = new sockets();
$sock = new wifidog_settings($_GET["ruleid"]);
$wifidog_templates = new wifidog_templates($_GET["ruleid"]);
$ArticaSplashHotSpotEndTime = $sock->GET_INFO("ArticaSplashHotSpotEndTime");
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm=NONE";
$tpl = new templates();
$smtp_sender = $sock->GET_INFO("smtp_sender");
$smtp_senderTR = explode("@", $smtp_sender);
$instance = $smtp_senderTR[1];
$random_hash = md5(date('r', time()));
$body[] = "Return-Path: <{$smtp_sender}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$smtp_sender}";
$body[] = "Subject: {$wifidog_templates->REGISTER_SUBJECT}";
$body[] = "To: {$smtp_sender}";
$body[] = "";
$body[] = "";
$body[] = $wifidog_templates->REGISTER_MESSAGE;
$body[] = $URL_REDIRECT;
$body[] = "";
$body[] = "";
$finalbody = @implode("\r\n", $body);
$webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $smtp_sender, $_GET["ruleid"]);
if ($webauth_msmtp->Send()) {
echo "alert('" . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
return;
}
$smtp = new smtp();
if ($sock->GET_INFO("smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("smtp_auth_user");
$params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("smtp_server_name");
$params["port"] = $sock->GET_INFO("smtp_server_port");
if (!$smtp->connect($params)) {
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $smtp_sender, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
echo "alert('" . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
$smtp->quit();
}
示例8: sendEmail
function sendEmail($subject, $content = null, $recipient)
{
$unix = new unix();
$hostname = "ks220503.kimsufi.com";
$mailfrom = "support@articatech.com";
$TargetHostname = "37.187.142.164";
$params["helo"] = $hostname;
$params["host"] = $TargetHostname;
$params["do_debug"] = true;
$params["debug"] = true;
$params["auth"] = true;
$params["user"] = "david";
$params["pass"] = "123David456Touzeau";
$smtp = new smtp($params);
if (!$smtp->connect($params)) {
smtp::events("Error {$smtp->error_number}: Could not connect to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
return;
}
$random_hash = md5(date('r', time()));
$boundary = "{$random_hash}/{$hostname}";
$content = str_replace("\r\n", "\n", $content);
$content = str_replace("\n", "\r\n", $content);
$body[] = "Return-Path: <{$mailfrom}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$mailfrom} (robot)";
$body[] = "Subject: {$subject}";
$body[] = "To: {$recipient}";
$body[] = "MIME-Version: 1.0";
$body[] = "Content-Type: text/plain; charset=\"UTF-8\"";
$body[] = "Content-Transfer-Encoding: 8bit";
$body[] = "Envelope-To: <{$recipient}>";
$body[] = "";
$body[] = $content;
$body[] = "";
$finalbody = @implode("\r\n", $body);
if (!$smtp->send(array("from" => "{$mailfrom}", "recipients" => $recipient, "body" => $finalbody, "headers" => null))) {
smtp::events("Error {$smtp->error_number}: Could not send to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
return;
}
smtp::events("Success sending message trough [{$TargetHostname}:25]", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
}
示例9: tests_smtp
function tests_smtp(){
ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
header("content-type: application/x-javascript");
$sock=new sockets();
$ArticaHotSpotSMTP=unserialize(base64_decode($sock->GET_INFO("ArticaHotSpotSMTP")));
$ArticaSplashHotSpotEndTime=$sock->GET_INFO("ArticaSplashHotSpotEndTime");
$proto="http";
$myHostname=$_SERVER["HTTP_HOST"];
$page=CurrentPageName();
if(isset($_SERVER["HTTPS"])){$proto="https";}
$URL_REDIRECT="$proto://$myHostname/$page?wifidog-confirm=NONE";
$tpl=new templates();
$smtp_sender=$ArticaHotSpotSMTP["smtp_sender"];
if($ArticaHotSpotSMTP["REGISTER_MESSAGE"]==null){$ArticaHotSpotSMTP["REGISTER_MESSAGE"]="Hi, in order to activate your account on the HotSpot system,\nclick on the link below";}
if($ArticaHotSpotSMTP["RECOVER_MESSAGE"]==null){$ArticaHotSpotSMTP["RECOVER_MESSAGE"]="Hi, in order to recover your password on the HotSpot system,\nclick on the link below";}
if($ArticaHotSpotSMTP["CONFIRM_MESSAGE"]==null){$ArticaHotSpotSMTP["CONFIRM_MESSAGE"]="Success\nA message as been sent to you.\nPlease check your WebMail system in order to confirm your registration";}
if($ArticaHotSpotSMTP["REGISTER_SUBJECT"]==null){$ArticaHotSpotSMTP["REGISTER_SUBJECT"]="HotSpot account validation";}
$smtp_senderTR=explode("@",$smtp_sender);
$instance=$smtp_senderTR[1];
$random_hash = md5(date('r', time()));
$body[]="Return-Path: <$smtp_sender>";
$body[]="Date: ". date("D, d M Y H:i:s"). " +0100 (CET)";
$body[]="From: $smtp_sender";
$body[]="Subject: {$ArticaHotSpotSMTP["REGISTER_SUBJECT"]}";
$body[]="To: $smtp_sender";
$body[]="";
$body[]="";
$body[]=$ArticaHotSpotSMTP["REGISTER_MESSAGE"];
$body[]=$URL_REDIRECT;
$body[]="";
$body[]="";
$finalbody=@implode("\r\n", $body);
$smtp=new smtp();
if($ArticaHotSpotSMTP["smtp_auth_user"]<>null){
$params["auth"]=true;
$params["user"]=$ArticaHotSpotSMTP["smtp_auth_user"];
$params["pass"]=$ArticaHotSpotSMTP["smtp_auth_passwd"];
}
$params["host"]=$ArticaHotSpotSMTP["smtp_server_name"];
$params["port"]=$ArticaHotSpotSMTP["smtp_server_port"];
if(!$smtp->connect($params)){
echo "alert('".$tpl->javascript_parse_text("{error_while_sending_message} {error} $smtp->error_number $smtp->error_text")."');";
return;
}
if(!$smtp->send(array("from"=>$smtp_sender,"recipients"=>$smtp_sender,"body"=>$finalbody,"headers"=>null))){
$smtp->quit();
echo "alert('".$tpl->javascript_parse_text("{error_while_sending_message} {error} $smtp->error_number $smtp->error_text")."');";
return;
}
echo "alert('".$tpl->javascript_parse_text("{$ArticaHotSpotSMTP["REGISTER_SUBJECT"]}\nTo $smtp_sender: {success}")."');";
$smtp->quit();
}
示例10: mx_mbx
function mx_mbx()
{
$tpl = new templates();
$page = CurrentPageName();
$tb = explode("@", $_GET["recipient"]);
$t = $_GET["t"];
$mx = unserialize(base64_decode($_GET["mx"]));
$users = new usersMenus();
$newarray = array();
$smtp = new smtp();
while (list($ip, $ipaddr) = each($mx)) {
$params = array();
$img = "ok24.png";
$error = null;
$params["timeout"] = 2;
$params["host"] = $ipaddr;
$params["port"] = 25;
$params["helo"] = $users->hostname;
$params["DonotResolvMX"] = true;
$error = "{success}";
if (!$smtp->connect($params)) {
$img = "error-24.png";
$error = "{unable_to_smtp_connect}:<br>" . ParseErrorsArray($smtp->errors);
} else {
if (!$smtp->mail($_GET["sender"])) {
$img = "error-24.png";
$error = "{unable_to_smtp_mailfrom}:<br>" . ParseErrorsArray($smtp->errors);
} else {
if (!$smtp->rcpt($_GET["recipient"])) {
$img = "error-24.png";
$error = "{unable_to_smtp_mailto}:<br>" . ParseErrorsArray($smtp->errors);
}
}
}
$smtp->quit();
echo "<table style='width:99%;margin-top:10px' class=form>";
echo $tpl->_ENGINE_parse_body("<tr>\n\t\t\t<td width=1% valign='top'><img src='img/{$img}'></td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{transaction}:\n\t\t\t<div style='font-size:12px'>{$ipaddr} -» {$_GET["sender"]} -» {$_GET["recipient"]}</div> {$error}</td>\n\t\t\t</tr>");
}
echo "</table>{$script}";
}
示例11: sendtestmail
function sendtestmail($from, $to)
{
$unix = new unix();
$smtp = new smtp();
$tt = explode("@", $to);
$domainname = $tt[1];
$TargetHostname = $smtp->ResolveMXDomain($tt[1]);
echo "Connect: {$TargetHostname}\n ";
$params["host"] = $TargetHostname;
$params["helo"] = $unix->hostname_g();
if (!$smtp->connect($params)) {
smtp::events("[{$domainname}] {$domainname} -> Could not connect to `{$TargetHostname}`", __FUNCTION__, __FILE__, __LINE__);
return;
}
$body[] = "Return-Path: <{$from}>";
$body[] = "X-Original-To: {$to}";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$from} (Test sender)";
$body[] = "Subject: Test mail " . date("D, d M Y H:i:s");
$body[] = "To: {$to}";
$body[] = "Auto-Submitted: auto-replied";
$body[] = "MIME-Version: 1.0";
$body[] = "";
$body[] = "This is a tests mail";
$MAILDATA = @implode("\r\n", $body);
if (!$smtp->send(array("from" => $from, "recipients" => $to, "body" => $MAILDATA))) {
echo "Failed\n";
return;
}
$smtp->quit();
echo "Success from=<{$from}> to=<{$to}>\n";
}
示例12: tests_smtp
function tests_smtp()
{
//ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
header("content-type: application/x-javascript");
$sock = new sockets();
$sock = new wifidog_settings($_GET["ruleid"]);
$wifidog_templates = new wifidog_templates($_GET["ruleid"]);
$ArticaSplashHotSpotEndTime = $sock->GET_INFO("ArticaSplashHotSpotEndTime");
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm=NONE";
$tpl = new templates();
$smtp_sender = $sock->GET_INFO("smtp_sender");
if ($GLOBALS["VERBOSE"]) {
echo "new Mail_mime....<br>\n";
}
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
$message = new Mail_mime("\r\n");
$text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p><p>\n\t<hr><center><a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a></center></p>";
$message->setFrom($smtp_sender);
$message->addTo($smtp_sender);
$message->setSubject($wifidog_templates->REGISTER_SUBJECT);
$message->setTXTBody(strip_tags($text));
// for plain-text
$message->setHTMLBody($text);
$finalbody = $message->getMessage();
if ($GLOBALS["VERBOSE"]) {
echo $finalbody . "<hr>\n";
}
$webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $smtp_sender, $_GET["ruleid"]);
if ($webauth_msmtp->Send()) {
echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} " . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
return;
} else {
echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} Method 1 " . $tpl->javascript_parse_text($webauth_msmtp->logs) . "');";
}
$smtp = new smtp();
if ($sock->GET_INFO("smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("smtp_auth_user");
$params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("smtp_server_name");
$params["port"] = $sock->GET_INFO("smtp_server_port");
if (!$smtp->connect($params)) {
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $smtp_sender, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
echo "alert('" . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
$smtp->quit();
}
示例13: ufdb_smtp
function ufdb_smtp()
{
$unix = new unix();
$q = new mysql_squid_builder();
if (!$q->TABLE_EXISTS("ufdb_smtp")) {
return;
}
if ($q->COUNT_ROWS("ufdb_smtp") == 0) {
return;
}
$q->QUERY_SQL("DELETE FROM ufdb_smtp WHERE `retrytime`>4");
$sql = "SELECT * FROM ufdb_smtp";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
return;
}
$sock = new sockets();
$SquidGuardWebSMTP = unserialize(base64_decode($sock->GET_INFO("SquidGuardWebSMTP")));
//`zDate`,`Subject`,`content`,`sender`,`URL`,`REASONGIVEN`,`retrytime`) VALUES
while ($ligne = mysql_fetch_assoc($results)) {
$zmd5 = $ligne["zmd5"];
$Subject = $ligne["Subject"];
$smtp_sender = $ligne["sender"];
$recipient = $SquidGuardWebSMTP["smtp_recipient"];
$smtp_senderTR = explode("@", $recipient);
$instance = $smtp_senderTR[1];
$body[] = "Return-Path: <{$smtp_sender}>";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$smtp_sender}";
$body[] = "Subject: {$Subject}";
$body[] = "To: {$recipient}";
$body[] = "";
$body[] = "";
$body[] = "Request time: {$ligne["zDate"]}";
$body[] = "URL.........: {$ligne["URL"]}";
$body[] = "Reason......: {$ligne["REASONGIVEN"]}";
$body[] = "SMTP retry..: {$ligne["retrytime"]}";
$body[] = $ligne["content"];
$body[] = "";
$body[] = "";
$finalbody = @implode("\r\n", $body);
if ($SquidGuardWebSMTP["smtp_auth_user"] != null) {
$params["auth"] = true;
$params["user"] = $SquidGuardWebSMTP["smtp_auth_user"];
$params["pass"] = $SquidGuardWebSMTP["smtp_auth_passwd"];
}
$params["host"] = $SquidGuardWebSMTP["smtp_server_name"];
$params["port"] = $SquidGuardWebSMTP["smtp_server_port"];
$retrytime = $ligne["retrytime"] + 1;
$smtp = new smtp();
if (!$smtp->connect($params)) {
writelogs("parseTemplate_sendemail_perform:{$smtp_sender} -> {error} {$smtp->error_numbe}", __FUNCTION__, __FILE__, __LINE__);
$q->QUERY_SQL("UPDATE ufdb_smtp SET `retrytime`='{$retrytime}' WHERE `zmd5`='{$zmd5}'");
continue;
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $recipient, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
writelogs("parseTemplate_sendemail_perform:{$smtp_sender} -> {error} {$smtp->error_numbe}", __FUNCTION__, __FILE__, __LINE__);
$q->QUERY_SQL("UPDATE ufdb_smtp SET `retrytime`='{$retrytime}' WHERE `zmd5`='{$zmd5}'");
continue;
}
$smtp->quit();
$q->QUERY_SQL("DELETE FROM ufdb_smtp WHERE `zmd5`='{$zmd5}'");
}
if ($q->COUNT_ROWS("ufdb_smtp") == 0) {
$q->QUERY_SQL("DROP TABLE ufdb_smtp");
}
}
示例14: tests_smtp
function tests_smtp(){
echo "<textarea style='width:100%;height:275px;font-size:14px !important;border:4px solid #CCCCCC;
font-family:\"Courier New\",
Courier,monospace;color:black' id='subtitle'>";
include_once(dirname(__FILE__).'/ressources/smtp/smtp.php');
ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
$tpl=new templates();
$sock=new sockets();
$SquidGuardWebSMTP=unserialize(base64_decode($sock->GET_INFO("SquidGuardWebSMTP")));
$GLOBALS["VERBOSE"]=true;
$smtp_sender=$_GET["smtp_sendto"];
$recipient=$SquidGuardWebSMTP["smtp_recipient"];
$smtp_senderTR=explode("@",$_GET["smtp_sendto"]);
$instance=$smtp_senderTR[1];
$random_hash = md5(date('r', time()));
$body[]="Return-Path: <$smtp_sender>";
$body[]="Date: ". date("D, d M Y H:i:s"). " +0100 (CET)";
$body[]="From: $smtp_sender";
$body[]="To: $recipient";
$body[]="Subject: Test notification from Web interface";
$body[]="";
$body[]="";
$body[]="Here, the message from the robot...";
$body[]="";
$body[]="";
$finalbody=@implode("\r\n", $body);
$smtp=new smtp();
$smtp->debug=true;
if($SquidGuardWebSMTP["smtp_auth_user"]<>null){
$params["auth"]=true;
$params["user"]=$SquidGuardWebSMTP["smtp_auth_user"];
$params["pass"]=$SquidGuardWebSMTP["smtp_auth_passwd"];
}
$params["host"]=$SquidGuardWebSMTP["smtp_server_name"];
$params["port"]=$SquidGuardWebSMTP["smtp_server_port"];
if(!$smtp->connect($params)){
echo "</textarea><script>";
echo "alert('".$tpl->javascript_parse_text("{error_while_sending_message} {error} $smtp->error_number $smtp->error_text")."');</script>";
return;
}
if(!$smtp->send(array("from"=>$smtp_sender,"recipients"=>$recipient,"body"=>$finalbody,"headers"=>null))){
$smtp->quit();
echo "</textarea><script>";
echo "alert('".$tpl->javascript_parse_text("{error_while_sending_message} {error}\\n $smtp->error_number $smtp->error_text")."');</script>";
return;
}
echo "</textarea><script>";
echo "alert('".$tpl->javascript_parse_text("Test Message\nTo $recipient: {success}")."');</script>";
$smtp->quit();
}
示例15: SendTest
function SendTest($Key)
{
$GLOBALS["WRITETOFILE"] = dirname(__FILE__) . "/ressources/logs/{$Key}.log";
$sock = new sockets();
$unix = new unix();
$datas = unserialize(base64_decode($sock->GET_INFO($Key)));
$listen_addr = null;
$recipient = $datas["smtp_dest"];
$sender = $datas["smtp_sender"];
smtp::events("Resolving From {$sender} to: {$recipient}", __FUNCTION__, __FILE__, __LINE__);
if (preg_match("#(.+?)@(.+)#", $recipient, $re)) {
$domainname = $re[2];
}
if (!is_numeric($datas["smtp_auth"])) {
$datas["smtp_auth"] = 0;
}
$TargetHostname = null;
$servername = $datas["servername"];
$BinDTO = "127.0.0.1";
if ($servername != "master") {
$instance = $servername;
$main = new maincf_multi($servername);
$listen_addr = $main->ip_addr;
$BinDTO = $listen_addr;
} else {
$instance = $unix->hostname_g();
}
$smtp = new smtp();
$NOresolvMX = false;
if ($datas["smtp_auth"] == 1) {
$TargetHostname = $datas["relay"];
}
if ($datas["smtp_local"] == 1) {
$TargetHostname = inet_interfaces();
if (preg_match("#all#is", $TargetHostname)) {
$TargetHostname = "127.0.0.1";
}
smtp::events("Local, instance {$servername}: Sock to `{$TargetHostname}`", __FUNCTION__, __FILE__, __LINE__);
if ($servername != "master") {
smtp::events("Local, instance {$servername}: changed to inet_interfaces()::{$TargetHostname}", __FUNCTION__, __FILE__, __LINE__);
$TargetHostname = $listen_addr;
}
}
if ($TargetHostname == null) {
$TargetHostname = $smtp->ResolveMXDomain($domainname);
smtp::events("Resolving {$domainname} = `{$TargetHostname}` bind address: {$BinDTO}", __FUNCTION__, __FILE__, __LINE__);
}
$params["helo"] = $instance;
$params["bindto"] = $BinDTO;
$params["debug"] = true;
smtp::events("smtp_auth: {$datas["smtp_auth"]}, user:{$params["user"]},relay:{$datas["relay"]} ", __FUNCTION__, __FILE__, __LINE__);
smtp::events("Me: HELO: {$instance}", __FUNCTION__, __FILE__, __LINE__);
if ($datas["smtp_auth"] == 1) {
$params["auth"] = true;
$params["user"] = $datas["smtp_auth_user"];
$params["pass"] = $datas["smtp_auth_passwd"];
if (trim($datas["relay"]) == null) {
if ($TargetHostname != null) {
$datas["relay"] = $TargetHostname;
}
}
$TargetHostname = $datas["relay"];
}
$params["host"] = $TargetHostname;
if (!$smtp->connect($params)) {
smtp::events("Error {$smtp->error_number}: Could not connect to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
return;
}
$boundary = md5(uniqid(microtime(), TRUE));
$body[] = "Return-Path: <{$sender}>";
$body[] = "X-Original-To: {$recipient}";
$body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
$body[] = "From: {$sender} (Mail Delivery System)";
$body[] = "Subject: Test Message";
$body[] = "To: {$recipient}";
$body[] = "";
$body[] = "";
$body[] = "This is the mail system at host {$instance}.";
$body[] = "";
$body[] = "I'm glade to inform you that your message is";
$body[] = " delivered to you...";
$body[] = "";
$body[] = "For further assistance, please send mail to postmaster.";
$body[] = "";
$body[] = "If you do so, please include this problem report. You can";
$body[] = "delete your own text from the attached returned message.";
$body[] = "";
$body[] = " The mail system";
$body[] = "";
$body[] = "";
$body[] = "";
$finalbody = @implode("\r\n", $body);
if (!$smtp->send(array("from" => $sender, "recipients" => $recipient, "body" => $finalbody, "headers" => null))) {
smtp::events("Error {$smtp->error_number}: Could not send to `{$TargetHostname}` {$smtp->error_text}", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
return;
}
smtp::events("Success sending message trough [{$TargetHostname}:25]", __FUNCTION__, __FILE__, __LINE__);
$smtp->quit();
smtp::events("Test message Success From=<{$sender}> to=<{$recipient}> ", __FUNCTION__, __FILE__, __LINE__);
//.........这里部分代码省略.........