本文整理汇总了PHP中smtp::send方法的典型用法代码示例。如果您正苦于以下问题:PHP smtp::send方法的具体用法?PHP smtp::send怎么用?PHP smtp::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtp
的用法示例。
在下文中一共展示了smtp::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SEND_MAIL
function SEND_MAIL()
{
$main = new maincf_multi($_POST["hostname"]);
$ipaddr = $main->ip_addr;
include_once dirname(__FILE__) . "/ressources/smtp/smtp.php";
$Parms["host"] = $ipaddr;
$Parms["DonotResolvMX"] = true;
$smtp = new smtp($Parms);
$smtp->bindto = $_POST["TESTS-BIND"];
$smtp->from = $_POST["TESTS-FROM"];
$smtp->recipients = $_POST["TESTS-TO"];
$f[] = "Return-Path: <{$_POST["TESTS-FROM"]}>";
$f[] = "Subject: {$_POST["TESTS-SUB"]}";
$f[] = "From: {$_POST["TESTS-FROM"]}";
$f[] = "Sender: {$_POST["TESTS-FROM"]}";
$f[] = "Reply-To: {$_POST["TESTS-FROM"]}";
$f[] = "X-Sender: {$_POST["TESTS-FROM"]}";
$f[] = "Envelope-To: {$_POST["TESTS-TO"]}";
$smtp->headers = @implode("\n", $f);
$smtp->body = $_POST["TESTS-BOD"];
if (!$smtp->connect()) {
echo "Instance {$_POST["hostname"]}\nIP: {$ipaddr}:25\n";
echo @implode("\n", $smtp->errors);
return;
}
if (!$smtp->send()) {
echo @implode("\n", $smtp->errors);
return;
}
echo @implode("\n", $smtp->errors);
}
示例2: send_mail
function send_mail($to, $subject, $body)
{
include FCPATH . APPPATH . 'libraries/smtp.php';
$smtpinfo = array();
$smtpinfo["host"] = "smtp.qq.com";
$smtpinfo["username"] = "de57@qq.com";
$smtpinfo["password"] = "de57.com";
$smtpinfo["port"] = "25";
$from = $smtpinfo['username'];
$subject = '=?utf-8?B?' . base64_encode($subject) . '?=';
$smtpMail = new smtp($smtpinfo['host'], $smtpinfo['username'], $smtpinfo['password'], $smtpinfo['port']);
$smtpMail->setHeader('Content-Transfer-Encoding', '8bit');
$smtpMail->setFrom($from, '=?utf-8?B?' . base64_encode("酷Live网") . '?=');
$smtpMail->addTo($to);
$smtpMail->setSubject($subject);
$smtpMail->setBody($body);
@$smtpMail->send();
}
示例3: archive_process_smtpsrv
function archive_process_smtpsrv($file, $realmailfrom, $realmailto)
{
$MailArchiverToSMTP = $GLOBALS["MailArchiverToSMTP"];
$MailArchiverSMTP = $GLOBALS["MailArchiverSMTP"];
$MailArchiverSMTPINcoming = $GLOBALS["MailArchiverSMTPINcoming"];
$MailArchiverSMTP_port = 25;
$SMTPSERV = true;
$realmailto = trim(strtolower($realmailto));
if ($MailArchiverSMTP == null) {
$SMTPSERV = false;
}
if ($MailArchiverSMTP == "localhost") {
$SMTPSERV = false;
}
if ($MailArchiverSMTP == "127.0.0.1") {
$SMTPSERV = false;
}
if (!$SMTPSERV) {
events("Not from=<{$realmailfrom}> to=<{$realmailto}> bad remote SMTP server `{$MailArchiverSMTP}`", __LINE__);
return true;
}
if (preg_match("#^(.+?)@(.+)#", $realmailto, $re)) {
$DomainTo = trim($re[1]);
}
if (!isset($GLOBALS["INBOUND_SMTP"])) {
$f = explode("\n", @file_get_contents("/etc/postfix/mydestination"));
while (list($num, $line) = each($f)) {
if (preg_match("#^(.+?)\\s+#", $line, $re)) {
$GLOBALS["INBOUND_SMTP"][trim(strtolower($re[1]))] = true;
}
}
$f = explode("\n", @file_get_contents("/etc/postfix/relay_domains"));
while (list($num, $line) = each($f)) {
if (preg_match("#^(.+?)\\s+#", $line, $re)) {
$GLOBALS["INBOUND_SMTP"][trim(strtolower($re[1]))] = true;
}
}
$f = explode("\n", @file_get_contents("/etc/postfix/virtual"));
while (list($num, $line) = each($f)) {
if (preg_match("#^(.+?)\\s+#", $line, $re)) {
$GLOBALS["INBOUND_SMTP"][trim(strtolower($re[1]))] = true;
}
}
}
$ISINBOUND = false;
if (isset($GLOBALS["INBOUND_SMTP"][$realmailto])) {
$ISINBOUND = true;
}
if (isset($GLOBALS["INBOUND_SMTP"][$DomainTo])) {
$ISINBOUND = true;
}
if ($MailArchiverSMTPINcoming == 1) {
if (!$ISINBOUND) {
events("Not from=<{$realmailfrom}> to=<{$realmailto}> not an inbound message", __LINE__);
return true;
}
}
if (preg_match("#^(.+?):([0-9]+)#", $MailArchiverSMTP, $re)) {
$MailArchiverSMTP = $re[1];
$MailArchiverSMTP_port = $re[2];
}
$basename = basename($file);
$smtp = new smtp();
$params["host"] = $MailArchiverSMTP;
$params["helo"] = $GLOBALS["MYHOSTNAME"];
$params["port"] = $MailArchiverSMTP_port;
//$params["bindto"]="127.0.0.1";
if (!$smtp->connect($params)) {
events("[{$basename}] {$realmailfrom} -> Could not connect to `{$MailArchiverSMTP}:{$MailArchiverSMTP_port}`", __LINE__);
smtp::events("[{$basename}] {$realmailfrom} -> Could not connect to `{$MailArchiverSMTP}:{$MailArchiverSMTP_port}`", __FUNCTION__, __FILE__, __LINE__);
return false;
}
$size = @filesize($file);
if ($size == 0) {
events("[{$basename}] Failed from=<{$realmailfrom}> to=<{$realmailto}> 0 bytes", __LINE__);
return true;
}
$MAILDATA = @file_get_contents($file);
$MAILDATA = str_replace("X-Archive-end", "X-REAL-ARCHIVED: yes", $MAILDATA);
$MAILDATA = str_replace("X-REAL-MAILFROM", "X-REAL-ARCHIVED: yes\r\nX-REAL-MAILFROM", $MAILDATA);
if (!$smtp->send(array("from" => $realmailfrom, "recipients" => $realmailto, "body" => $MAILDATA))) {
events("[{$basename}] Failed from=<{$realmailfrom}> to=<{$realmailto}>", __LINE__);
smtp::events("[{$basename}] Failed from=<{$realmailfrom}> to=<{$realmailto}>", __FUNCTION__, __FILE__, __LINE__);
return false;
}
events("Success from=<{$realmailfrom}> to=<{$realmailto}> trough {$params["host"]}", __LINE__);
if ($GLOBALS["VERBOSE"]) {
echo "Success from=<{$realmailto}> to=<{$realmailto}> trough {$params["host"]}\n";
}
return true;
}
示例4: send
/**
* Sends the mail.
*
* @param array $recipients
* @param string $type OPTIONAL
* @return mixed
*/
function send($recipients, $type = 'mail')
{
if (!defined('CRLF')) {
$this->setCrlf($type == 'mail' ? "\n" : "\r\n");
}
if (!$this->is_built) {
$this->buildMessage();
}
switch ($type) {
case 'mail':
$subject = '';
if (!empty($this->headers['Subject'])) {
$subject = $this->_encodeHeader($this->headers['Subject'], $this->build_params['head_charset']);
unset($this->headers['Subject']);
}
// Get flat representation of headers
foreach ($this->headers as $name => $value) {
$headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']);
}
$to = $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']);
if (!empty($this->return_path)) {
$result = mail($to, $subject, $this->output, implode(CRLF, $headers), '-f' . $this->return_path);
} else {
$result = mail($to, $subject, $this->output, implode(CRLF, $headers));
}
// Reset the subject in case mail is resent
if ($subject !== '') {
$this->headers['Subject'] = $subject;
}
// Return
return $result;
break;
case 'smtp':
require_once dirname(__FILE__) . '/smtp.php';
require_once dirname(__FILE__) . '/RFC822.php';
// $smtp = smtp::connect($this->smtp_params);
$smtp = new smtp($this->smtp_params);
$smtp->connect($this->smtp_params);
$Mail_RFC822 = new Mail_RFC822();
// Parse recipients argument for internet addresses
foreach ($recipients as $recipient) {
$addresses = $Mail_RFC822->parseAddressList($recipient, $this->smtp_params['helo'], null, false);
// $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false);
foreach ($addresses as $address) {
$smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host);
}
}
unset($addresses);
// These are reused
unset($address);
// These are reused
// Get flat representation of headers, parsing
// Cc and Bcc as we go
foreach ($this->headers as $name => $value) {
if ($name == 'Cc' or $name == 'Bcc') {
// $addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false);
$addresses = $Mail_RFC822->parseAddressList($value, $this->smtp_params['helo'], null, false);
foreach ($addresses as $address) {
$smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host);
}
}
if ($name == 'Bcc') {
continue;
}
$headers[] = $name . ': ' . $this->_encodeHeader($value, $this->build_params['head_charset']);
}
// Add To header based on $recipients argument
$headers[] = 'To: ' . $this->_encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']);
// Add headers to send_params
$send_params['headers'] = $headers;
$send_params['recipients'] = array_values(array_unique($smtp_recipients));
$send_params['body'] = $this->output;
// Setup return path
if (isset($this->return_path)) {
$send_params['from'] = $this->return_path;
} elseif (!empty($this->headers['From'])) {
// $from = Mail_RFC822::parseAddressList($this->headers['From']);
$from = $Mail_RFC822->parseAddressList($this->headers['From']);
$send_params['from'] = sprintf('%s@%s', $from[0]->mailbox, $from[0]->host);
} else {
$send_params['from'] = 'postmaster@' . $this->smtp_params['helo'];
}
// Send it
if (!$smtp->send($send_params)) {
$this->errors = $smtp->errors;
return false;
}
return true;
break;
}
}
示例5: 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();
}
示例6: smtp
// допустим, мы получаем адресатов с какого-то запроса
$i = 0;
while ($users = $master->col("{$sql} LIMIT 30000 OFFSET ?", $i)) {
$DB->query("SELECT masssend_bind(?, {$sender['uid']}, ?a)", $msgid, $users);
$i = $i + 30000;
}
$DB->query("SELECT masssend_commit(?, ?)", $msgid, $sender['uid']);
echo "Send email messages\n";
$mail = new smtp();
$mail->subject = $eSubject;
// заголовок письма
$mail->message = $eMessage;
// текст письма
$mail->recipient = '';
// свойство 'получатель' оставляем пустым
$spamid = $mail->send('text/html');
if (!$spamid) {
die('Failed!');
}
// с этого момента рассылка создана, но еще никому не отправлена!
// допустим нам нужно получить список получателей с какого-либо запроса
$i = 0;
$mail->recipient = array();
$res = $master->query($sql);
while ($row = pg_fetch_assoc($res)) {
$mail->recipient[] = array('email' => $row['email'], 'extra' => array('first_name' => $row['uname'], 'last_name' => $row['usurname'], 'USER_LOGIN' => $row['login']));
if (++$i >= 30000) {
$mail->bind($spamid);
$mail->recipient = array();
$i = 0;
}
示例7: smtp_mail
function smtp_mail($address, $subject, $message)
{
global $_config;
require_once SYSTEM_ROOT . './class/smtp.php';
$smtp = new smtp();
return $smtp->send($address, $subject, $message);
}
示例8: send_mail
/**
* Óʼþ·¢ËÍ.
*
* @param: $name[string] ½ÓÊÕÈËÐÕÃû
* @param: $email[string] ½ÓÊÕÈËÓʼþµØÖ·
* @param: $subject[string] Óʼþ±êÌâ
* @param: $content[string] ÓʼþÄÚÈÝ
* @param: $type[int] 0 ÆÕͨÓʼþ£¬ 1 HTMLÓʼþ
* @param: $notification[bool] true ÒªÇó»ØÖ´£¬ false ²»ÓûØÖ´
*
* @return bool
*/
function send_mail($name, $email, $subject, $content, $type = 0, $notification = false)
{
/* Èç¹ûÓʼþ±àÂë²»ÊÇEC_CHARSET£¬´´½¨×Ö·û¼¯×ª»»¶ÔÏó£¬×ª»»±àÂë */
if ($GLOBALS['_CFG']['mail_charset'] != EC_CHARSET) {
$name = ecs_iconv(EC_CHARSET, $GLOBALS['_CFG']['mail_charset'], $name);
$subject = ecs_iconv(EC_CHARSET, $GLOBALS['_CFG']['mail_charset'], $subject);
$content = ecs_iconv(EC_CHARSET, $GLOBALS['_CFG']['mail_charset'], $content);
$shop_name = ecs_iconv(EC_CHARSET, $GLOBALS['_CFG']['mail_charset'], $GLOBALS['_CFG']['shop_name']);
}
$charset = $GLOBALS['_CFG']['mail_charset'];
/*
* ʹÓÃmailº¯Êý·¢ËÍÓʼþ
*/
if ($GLOBALS['_CFG']['mail_service'] == 0 && function_exists('mail')) {
/* ÓʼþµÄÍ·²¿ÐÅÏ¢ */
$content_type = $type == 0 ? 'Content-Type: text/plain; charset=' . $charset : 'Content-Type: text/html; charset=' . $charset;
$headers = array();
$headers[] = 'From: "' . '=?' . $charset . '?B?' . base64_encode($shop_name) . '?=' . '" <' . $GLOBALS['_CFG']['smtp_mail'] . '>';
$headers[] = $content_type . '; format=flowed';
if ($notification) {
$headers[] = 'Disposition-Notification-To: ' . '=?' . $charset . '?B?' . base64_encode($shop_name) . '?=' . '" <' . $GLOBALS['_CFG']['smtp_mail'] . '>';
}
$res = @mail($email, '=?' . $charset . '?B?' . base64_encode($subject) . '?=', $content, implode("\r\n", $headers));
if (!$res) {
$GLOBALS['err']->add($GLOBALS['_LANG']['sendemail_false']);
return false;
} else {
return true;
}
} else {
/* ÓʼþµÄÍ·²¿ÐÅÏ¢ */
$content_type = $type == 0 ? 'Content-Type: text/plain; charset=' . $charset : 'Content-Type: text/html; charset=' . $charset;
$content = base64_encode($content);
$headers = array();
$headers[] = 'Date: ' . gmdate('D, j M Y H:i:s') . ' +0000';
$headers[] = 'To: "' . '=?' . $charset . '?B?' . base64_encode($name) . '?=' . '" <' . $email . '>';
$headers[] = 'From: "' . '=?' . $charset . '?B?' . base64_encode($shop_name) . '?=' . '" <' . $GLOBALS['_CFG']['smtp_mail'] . '>';
$headers[] = 'Subject: ' . '=?' . $charset . '?B?' . base64_encode($subject) . '?=';
$headers[] = $content_type . '; format=flowed';
$headers[] = 'Content-Transfer-Encoding: base64';
$headers[] = 'Content-Disposition: inline';
if ($notification) {
$headers[] = 'Disposition-Notification-To: ' . '=?' . $charset . '?B?' . base64_encode($shop_name) . '?=' . '" <' . $GLOBALS['_CFG']['smtp_mail'] . '>';
}
/* »ñµÃÓʼþ·þÎñÆ÷µÄ²ÎÊýÉèÖà */
$params['host'] = $GLOBALS['_CFG']['smtp_host'];
$params['port'] = $GLOBALS['_CFG']['smtp_port'];
$params['user'] = $GLOBALS['_CFG']['smtp_user'];
$params['pass'] = $GLOBALS['_CFG']['smtp_pass'];
if (empty($params['host']) || empty($params['port'])) {
// Èç¹ûûÓÐÉèÖÃÖ÷»úºÍ¶Ë¿ÚÖ±½Ó·µ»Ø false
$GLOBALS['err']->add($GLOBALS['_LANG']['smtp_setting_error']);
return false;
} else {
// ·¢ËÍÓʼþ
if (!function_exists('fsockopen')) {
//Èç¹ûfsockopen±»½ûÓã¬Ö±½Ó·µ»Ø
$GLOBALS['err']->add($GLOBALS['_LANG']['disabled_fsockopen']);
return false;
}
include_once ROOT_PATH . 'includes/cls_smtp.php';
static $smtp;
$send_params['recipients'] = $email;
$send_params['headers'] = $headers;
$send_params['from'] = $GLOBALS['_CFG']['smtp_mail'];
$send_params['body'] = $content;
if (!isset($smtp)) {
$smtp = new smtp($params);
}
if ($smtp->connect() && $smtp->send($send_params)) {
return true;
} else {
$err_msg = $smtp->error_msg();
if (empty($err_msg)) {
$GLOBALS['err']->add('Unknown Error');
} else {
if (strpos($err_msg, 'Failed to connect to server') !== false) {
$GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['smtp_connect_failure'], $params['host'] . ':' . $params['port']));
} elseif (strpos($err_msg, 'AUTH command failed') !== false) {
$GLOBALS['err']->add($GLOBALS['_LANG']['smtp_login_failure']);
} elseif (strpos($err_msg, 'bad sequence of commands') !== false) {
$GLOBALS['err']->add($GLOBALS['_LANG']['smtp_refuse']);
} else {
$GLOBALS['err']->add($err_msg);
}
}
return false;
}
//.........这里部分代码省略.........
示例9: wifidog_register_perform
//.........这里部分代码省略.........
}
}
$q->QUERY_SQL($sql);
}
}
if (!$q->ok) {
ToSyslog("{$q->mysql_error}");
return wifidog_register($q->mysql_error);
}
if ($ArticaHotSpotSMTP["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"];
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"];
示例10: commentInThemeOfCommune
/**
* Уведомление о новом комментарии в теме сообщества.
*
* @param $themeName - Наименование темы в сообществе
* @param $communeName - Наименование сообщества
* @param $userLink - ссылка на профиль пользователя оставившего комментарий
* @param $authorName - имя автора комментария
* @param $authorLogin - логин автора комментария
* @param $authorSurname - фамилия автора комментария
* @param $msgtext - текст сообщения,
* @param $domain - домен
* @param $url - ссылка на комментарий,
* @param $recipientName - имя получателя,
* @param $recipientSurname - фамилия получателя,
* @param $recipientLogin - логин получателя,
* @param $email - адрес получателя
* @param $topicUrl - ссылка на тему сообщества
* @param $communeUrl - ссылка на сообщество
* */
public function commentInThemeOfCommune($themeName, $communeName, $userLink, $authorName, $authorLogin, $authorSurname, $msgtext, $domain, $url, $recipientName, $recipientSurname, $recipientLogin, $email, $topicUrl, $communeUrl)
{
$body = " \n \t В сообщении \"<a href=\"{$topicUrl}\">{$themeName}</a>\" сообщества \"<a href=\"{$communeUrl}\">{$communeName}</a>\", на которое вы подписались <a href=\"{$userLink}\">{$authorName}</a> <a href=\"{$userLink}\">{$authorSurname}</a> [<a href=\"{$userLink}\">{$authorLogin}</a>] оставил(а) <a href=\"{$url}\">комментарий</a> к сообщению/комментарию.\n \t <br/>\n \t --------<br/>" . reformat(LenghtFormatEx(strip_tags($msgtext, '<br><p>'), 300)) . '
--------
';
$mail = new smtp();
$mail->subject = 'Новый комментарий в сообщении «' . $themeName . '» сообщества «' . $communeName . '»';
$mail->message = $mail->GetHtml($recipientName, $body, array('header' => 'subscribe', 'footer' => 'subscribe'), array('login' => $recipientLogin));
$mail->recipient = $recipientName . ' ' . $recipientSurname . ' [' . $recipientLogin . '] <' . $email . '>';
$mail->send('text/html');
}
示例11: 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}");
}
示例12: 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";
}
示例13: 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();
}
示例14: 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();
}
示例15: 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");
}
}