本文整理汇总了PHP中POP3::Authorise方法的典型用法代码示例。如果您正苦于以下问题:PHP POP3::Authorise方法的具体用法?PHP POP3::Authorise怎么用?PHP POP3::Authorise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POP3
的用法示例。
在下文中一共展示了POP3::Authorise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zenphoto_PHPMailer
function zenphoto_PHPMailer($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
require_once dirname(__FILE__) . '/PHPMailer/class.phpmailer.php';
switch (getOption('PHPMailer_mail_protocol')) {
case 'pop3':
require_once dirname(__FILE__) . '/PHPMailer/class.pop3.php';
$pop = new POP3();
$authorized = $pop->Authorise(getOption('PHPMailer_server'), getOption('PHPMailer_pop_port'), 30, getOption('PHPMailer_user'), getOption('PHPMailer_password'), 0);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Port = getOption('PHPMailer_smtp_port');
$mail->Host = getOption('PHPMailer_server');
break;
case 'smtp':
$mail = new PHPMailer();
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->IsSMTP();
$mail->Username = getOption('PHPMailer_user');
$mail->Password = getOption('PHPMailer_password');
$mail->Host = getOption('PHPMailer_server');
$mail->Port = getOption('PHPMailer_smtp_port');
break;
case 'sendmail':
$mail = new PHPMailer();
$mail->IsSendmail();
break;
}
$mail->SMTPSecure = getOption('PHPMailer_secure');
$mail->CharSet = 'UTF-8';
$mail->From = $from_mail;
$mail->FromName = $from_name;
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = '';
$mail->IsHTML($html);
foreach ($email_list as $to_name => $to_mail) {
if (is_numeric($to_name)) {
$mail->AddAddress($to_mail);
} else {
$mail->AddAddress($to_mail, $to_name);
}
}
if (count($cc_addresses) > 0) {
foreach ($cc_addresses as $cc_name => $cc_mail) {
$mail->AddCC($cc_mail);
}
}
if ($replyTo) {
$names = array_keys($replyTo);
$mail->AddReplyTo(array_shift($replyTo), array_shift($names));
}
if (!$mail->Send()) {
if (!empty($msg)) {
$msg .= '<br />';
}
$msg .= sprintf(gettext('<code>PHPMailer</code> failed to send <em>%1$s</em>. ErrorInfo:%2$s'), $subject, $mail->ErrorInfo);
}
return $msg;
}
示例2: SendMail
function SendMail($toAddress, $toName, $subject, $messageBody, $bcc = NULL, $mailList = FALSE)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
if ($mailList) {
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService2.php";
} else {
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService.php";
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.phpmailer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.pop3.php";
if ($MailServiceAuthPOP3) {
$pop = new POP3();
$pop->Authorise($MailServicePOP3Addr, $MailServicePOP3Port, 30, $MailServiceSMTPUser, $MailServiceSMTPPass, $MailServicePOPDebug);
}
$mail = new PHPMailer();
if ($MailServiceMailerLang != "en") {
$mail->SetLanguage($MailServiceMailerLang, $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/language/");
}
$mail->IsSMTP();
$mail->SMTPDebug = $MailServiceSMTPDebug;
$mail->Port = $MailServiceSMTPPort;
$mail->SMTPSecure = $MailServiceEncrypt;
$mail->Host = $MailServiceSMTPAddr;
$mail->SMTPAuth = $MailServiceAuthSMTP;
$mail->Username = $MailServiceSMTPUser;
$mail->Password = $MailServiceSMTPPass;
$mail->From = $MailServiceFromMail;
$mail->FromName = $MailServiceFromName;
$mail->AddAddress($toAddress, $toName);
if ($bcc != NULL) {
if (is_array($bcc)) {
foreach ($bcc as $key => $value) {
$mail->AddBCC($value);
}
}
}
$mail->WordWrap = 50;
$mail->CharSet = $MailServiceMsgCharset;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $messageBody;
if ($mail->Send()) {
return true;
} else {
return $mail->ErrorInfo;
}
}
示例3: sendMail
function sendMail($_msubject, $_mbody, $_mto, $_mname)
{
global $SMTP_FROMNAME;
$pop = new POP3();
$pop->Authorise('envasadoras.com.mx', 110, 30, 't&e-hod', 'tyeh2014', 1);
$mail = new PHPMailer();
//Luego tenemos que iniciar la validación por SMTP:
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "envasadoras.com.mx";
// SMTP a utilizar. Por ej. smtp.elserver.com
//$mail->Username = "t&e-hod"; // Correo completo a utilizar
//$mail->Password = "tyeh2014"; // Contraseña
$mail->Port = 25;
// Puerto a utilizar
$mail->From = "t&e-hod@envasadoras.com.mx";
// Desde donde enviamos (Para mostrar)
$mail->FromName = "Sistema de Gastos de Viaje";
$cnt = 0;
if (stristr($_mto, ",") === FALSE) {
//EVALUAMOS SI TIENE , PARA SACAR A LOS USUARIOS QUE SE MANDARA EL MAIL :)
$mail->AddAddress($_mto, $_mname);
} else {
$aux = explode(",", $_mto);
foreach ($aux as $direccion) {
$mail->AddAddress(trim($direccion), $_mname);
$cnt++;
}
}
$mail->WordWrap = 50;
// set word wrap
$mail->IsHTML(TRUE);
// send as HTML
$mail->Subject = $_msubject;
$mail->Body = $_mbody;
if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
return -1;
}
return 0;
//echo " Mensaje Enviado.\n";
}
示例4: action_index
public function action_index()
{
if (!empty($_REQUEST["f_rename"])) {
if ($this->model->valid($_POST["f_mail"], $_POST["f_login"]) > 0) {
$maincfg = Configs::readCfg("main", tbuild);
if ($maincfg["usemd5"] == 0) {
$pwd = $this->model->viewPwd($_POST["f_login"]);
} else {
$pwd = $this->model->getNewPwd($_POST["f_login"], 1);
}
if ($this->configs["useMail"] != 1) {
echo "<script>alert('password is: {$pwd}');</script>";
} else {
$c_mail = Configs::readCfg("mail", tbuild);
require "libraries/PHPMailer/PHPMailerAutoload.php";
$pop = new POP3();
$pop->Authorise($c_mail["mailhost"], $c_mail["mailport"], $c_mail["mailtmout"], $c_mail["mailboxf"], $c_mail["mailpbf"], $c_mail["maildlvl"]);
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
$mail->Host = $c_mail["mailhost"];
$mail->SMTPAuth = true;
$mail->Username = $c_mail["mailboxf"];
$mail->Password = $c_mail["mailpbf"];
$mail->SetFrom($c_mail["mailboxf"], $c_mail["mailnamefrom"]);
$mail->AddReplyTo($c_mail["mailboxf"], $c_mail["mailnib"]);
$mail->Subject = "Register";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$this->view->set("fl_login", $_POST["f_login"])->set("fl_pwd", $pwd);
$mail->MsgHTML($this->view->out("register", "mail", 2));
$mail->AddAddress($_POST['f_mail']);
if (!$mail->Send()) {
$this->model->toLog("Mail error:" . $mail->ErrorInfo, "register", 13);
}
echo "<script>alert('Password was send to your e-mail');</script>";
}
}
}
$this->view->out("forgotpwd");
}
示例5: PHPMailer
<html>
<head>
<title>POP before SMTP Test</title>
</head>
<body>
<?php
require_once '../class.phpmailer.php';
require_once '../class.pop3.php';
// required for POP before SMTP
$pop = new POP3();
$pop->Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1);
$mail = new PHPMailer(true);
// the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP();
try {
$mail->SMTPDebug = 2;
$mail->Host = 'pop3.yourdomain.com';
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
$mail->AddAddress('whoto@otherdomain.com', 'John Doe');
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
// optional - MsgHTML will create an alternate automatically
$mail->MsgHTML(file_GET_contents('contents.html'));
$mail->AddAttachment('images/phpmailer.gif');
// attachment
$mail->AddAttachment('images/phpmailer_mini.gif');
// attachment
$mail->Send();
示例6: cforms_phpmailer
function cforms_phpmailer($no, $frommail, $field_email, $to, $vsubject, $message, $formdata, $htmlmessage, $htmlformdata, $file = 'ac')
{
global $smtpsettings, $phpmailer, $cformsSettings;
$eol = $cformsSettings['global']['cforms_crlf'][b] != 1 ? "\r\n" : "\n";
if (file_exists(dirname(__FILE__) . '/class.phpmailer.php') && !class_exists('PHPMailer')) {
require_once dirname(__FILE__) . '/class.phpmailer.php';
require_once dirname(__FILE__) . '/class.smtp.php';
if ($smtpsettings[6] == '1') {
require_once dirname(__FILE__) . '/class.pop3.php';
}
}
### pop before smtp?
if ($smtpsettings[6] == '1' && class_exists('POP3')) {
$debuglevel = 0;
$pop = new POP3();
$pop->Authorise($smtpsettings[7], $smtpsettings[8], 30, $smtpsettings[9], $smtpsettings[10], $debuglevel);
}
$mail = new PHPMailer();
$mail->ClearAllRecipients();
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->CharSet = 'utf-8';
$mail->SetLanguage('en', dirname(__FILE__) . '/');
$mail->PluginDir = dirname(__FILE__) . '/';
$mail->IsSMTP();
$mail->Host = $smtpsettings[1];
if ((int) $cformsSettings['form' . $no]['cforms' . $no . '_emailpriority'] > 0) {
$mail->Priority = (int) $cformsSettings['form' . $no]['cforms' . $no . '_emailpriority'];
}
### $mail->SMTPDebug = true;
if ($smtpsettings[4] != '') {
$mail->SMTPSecure = $smtpsettings[4];
### sets the prefix to the servier
$mail->Port = $smtpsettings[5];
### set the SMTP port
}
if ($smtpsettings[2] != '') {
$mail->SMTPAuth = true;
### turn on SMTP authentication
$mail->Username = $smtpsettings[2];
### SMTP username
$mail->Password = $smtpsettings[3];
### SMTP password
}
$temp2 = array();
###from
if (preg_match('/([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})/', $frommail, $temp)) {
$mail->From = $temp[0];
}
if (preg_match('/(.*)\\s+(([\\w-\\.]+@|<)).*/', $frommail, $temp2)) {
$mail->FromName = str_replace('"', '', $temp2[1]);
} else {
$mail->FromName = $temp[0];
}
$temp2 = array();
### reply-to
if (preg_match('/([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})/', $field_email, $temp)) {
if (preg_match('/(.*)\\s+(([\\w-\\.]+@|<)).*/', $field_email, $temp2)) {
$mail->AddReplyTo($temp[0], str_replace('"', '', $temp2[1]));
} else {
$mail->AddReplyTo($temp[0]);
}
}
### TAF: add CC
if (substr($cformsSettings['form' . $no]['cforms' . $no . '_tellafriend'], 0, 1) == '1' && $file == 'ac') {
$mail->AddCC($temp[0], str_replace('"', '', $temp2[1]));
}
### bcc
$te = array();
$t = array();
$addresses = explode(',', stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_bcc']));
foreach ($addresses as $a) {
if (preg_match('/([\\w-+\\.]+@([\\w-]+\\.)+[\\w-]{2,4})/', $a, $te)) {
$mail->AddBCC($te[0]);
}
}
###to
###if( preg_match('/[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/',$to,$temp) )
### $mail->AddAddress($temp[0]);
$addresses = explode(',', $to);
foreach ($addresses as $address) {
if (preg_match('/([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})/', $address, $temp)) {
if (preg_match('/(.*)\\s+(([\\w-\\.]+@|<)).*/', $address, $temp2)) {
$mail->AddAddress($temp[0], str_replace('"', '', $temp2[1]));
} else {
$mail->AddAddress($temp[0]);
}
}
}
###
### HTML email ?
###
if ($htmlmessage != '') {
$htmlmessage = str_replace('=3D', '=', $htmlmessage);
###remove 3D's
$htmlformdata = str_replace('=3D', '=', $htmlformdata);
###remove 3D's,
$mail->IsHTML(true);
$mail->Body = "<html>" . $eol . "<body>" . stripslashes($htmlmessage) . (substr($cformsSettings['form' . $no]['cforms' . $no . '_formdata'], 1, 1) == '1' && $htmlformdata != '' ? $eol . $htmlformdata : '') . $eol . "</body></html>" . $eol;
$mail->AltBody = stripslashes($message) . (substr($cformsSettings['form' . $no]['cforms' . $no . '_formdata'], 0, 1) == '1' && $formdata != '' ? $eol . $formdata : '');
//.........这里部分代码省略.........
示例7: osc_sendMail
function osc_sendMail($params)
{
if (key_exists('add_bcc', $params)) {
if (!is_array($params['add_bcc']) && $params['add_bcc'] != '') {
$params['add_bcc'] = array($params['add_bcc']);
}
}
require_once osc_lib_path() . 'phpmailer/class.phpmailer.php';
if (osc_mailserver_pop()) {
require_once osc_lib_path() . 'phpmailer/class.pop3.php';
$pop = new POP3();
$pop->Authorise(isset($params['host']) ? $params['host'] : osc_mailserver_host(), isset($params['port']) ? $params['port'] : osc_mailserver_port(), 30, isset($params['username']) ? $params['username'] : osc_mailserver_username(), isset($params['username']) ? $params['username'] : osc_mailserver_username(), 0);
}
$mail = new PHPMailer(true);
try {
$mail->CharSet = 'utf-8';
if (osc_mailserver_auth()) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
} else {
if (osc_mailserver_pop()) {
$mail->IsSMTP();
}
}
$mail->SMTPSecure = isset($params['ssl']) ? $params['ssl'] : osc_mailserver_ssl();
$mail->Username = isset($params['username']) ? $params['username'] : osc_mailserver_username();
$mail->Password = isset($params['password']) ? $params['password'] : osc_mailserver_password();
$mail->Host = isset($params['host']) ? $params['host'] : osc_mailserver_host();
$mail->Port = isset($params['port']) ? $params['port'] : osc_mailserver_port();
$mail->From = isset($params['from']) ? $params['from'] : osc_contact_email();
$mail->FromName = isset($params['from_name']) ? $params['from_name'] : osc_page_title();
$mail->Subject = isset($params['subject']) ? $params['subject'] : '';
$mail->Body = isset($params['body']) ? $params['body'] : '';
$mail->AltBody = isset($params['alt_body']) ? $params['alt_body'] : '';
$to = isset($params['to']) ? $params['to'] : '';
$to_name = isset($params['to_name']) ? $params['to_name'] : '';
if (key_exists('add_bcc', $params)) {
foreach ($params['add_bcc'] as $bcc) {
$mail->AddBCC($bcc);
}
}
if (isset($params['reply_to'])) {
$mail->AddReplyTo($params['reply_to']);
}
if (isset($params['attachment'])) {
$mail->AddAttachment($params['attachment']);
}
$mail->IsHTML(true);
$mail->AddAddress($to, $to_name);
$mail->Send();
return true;
} catch (phpmailerException $e) {
error_log("phpmailerException in osc_sendMail() Error: " . $mail->ErrorInfo, 0);
return false;
} catch (Exception $e) {
error_log("Exception in osc_sendMail() Error" . $mail->ErrorInfo, 0);
return false;
}
return false;
}
示例8: PHPMailer
<html>
<head>
<title>POP before SMTP Test</title>
</head>
<body>
<pre>
<?php
require 'class.phpmailer.php';
require 'class.pop3.php';
$pop = new POP3();
$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->IsHTML(false);
$mail->Host = 'relay.example.com';
$mail->From = 'mailer@example.com';
$mail->FromName = 'Example Mailer';
$mail->Subject = 'My subject';
$mail->Body = 'Hello world';
$mail->AddAddress('name@anydomain.com', 'First Last');
if (!$mail->Send()) {
echo $mail->ErrorInfo;
}
?>
</pre>
</body>
</html>
示例9: __construct
/**
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
*
* @var array $overrides - array of values which override mail-related prefs. Key is the same as the corresponding pref.
* @return none
*/
public function __construct($overrides = FALSE)
{
parent::__construct(FALSE);
// Parent constructor - no exceptions for now
$e107 = e107::getInstance();
global $pref;
//Load up Email Templates
include e107::coreTemplatePath('email', 'front');
$this->templateOption['email'] = array('header' => $EMAIL_HEADER, 'footer' => $EMAIL_FOOTER);
$this->templateOption['notify'] = array('header' => $NOTIFY_HEADER, 'footer' => $NOTIFY_FOOTER);
$this->templateOption['mailout'] = array('header' => $MAILOUT_HEADER, 'footer' => $MAILOUT_FOOTER);
$this->CharSet = 'utf-8';
$this->SetLanguage(CORE_LC);
if ($overrides === FALSE || !is_array($overrides)) {
$overrides = array();
}
foreach (array('mailer', 'smtp_server', 'smtp_username', 'smtp_password', 'sendmail', 'siteadminemail', 'siteadmin', 'smtp_pop3auth') as $k) {
if (!isset($overrides[$k])) {
$overrides[$k] = $pref[$k];
}
}
$this->pause_amount = varset($pref['mail_pause'], 10);
$this->pause_time = varset($pref['mail_pausetime'], 1);
if (varsettrue($pref['mail_options'])) {
$this->general_opts = explode(',', $pref['mail_options'], '');
}
if (defined('MAIL_DEBUG')) {
echo 'Mail_options: ' . $pref['mail_options'] . ' Count: ' . count($this->general_opts) . '<br />';
}
foreach ($this->general_opts as $k => $v) {
$v = trim($v);
$this->general_opts[$k] = $v;
if (strpos($v, 'hostname') === 0) {
list(, $this->HostName) = explode('=', $v);
if (defined('MAIL_DEBUG')) {
echo "Host name set to: {$this->HostName}<br />";
}
}
}
list($this->logEnable, $this->add_email) = explode(',', varset($pref['mail_log_options'], '0,0'));
switch ($overrides['mailer']) {
case 'smtp':
$smtp_options = array();
$temp_opts = explode(',', varset($pref['smtp_options'], ''));
if (varsettrue($overrides['smtp_pop3auth'])) {
$temp_opts[] = 'pop3auth';
}
// Legacy option - remove later
if (varsettrue($pref['smtp_keepalive'])) {
$temp_opts[] = 'keepalive';
}
// Legacy option - remove later
foreach ($temp_opts as $k => $v) {
if (strpos($v, '=') !== FALSE) {
list($v, $k) = explode('=', $v, 2);
$smtp_options[trim($v)] = trim($k);
} else {
$smtp_options[trim($v)] = TRUE;
// Simple on/off option
}
}
unset($temp_opts);
$this->IsSMTP();
// Enable SMTP functions
if (varsettrue($smtp_options['helo'])) {
$this->Helo = $smtp_options['helo'];
}
if (isset($smtp_options['pop3auth'])) {
// Need POP-before-SMTP authorisation
require_once e_HANDLER . 'phpmailer/class.pop3.php';
$pop = new POP3();
$pop->Authorise($overrides['smtp_server'], 110, 30, $overrides['smtp_username'], $overrides['smtp_password'], 1);
}
$this->Mailer = 'smtp';
$this->localUseVerp = isset($smtp_options['useVERP']);
if (isset($smtp_options['secure'])) {
switch ($smtp_options['secure']) {
case 'TLS':
$this->SMTPSecure = 'tls';
$this->Port = 465;
// Can also use port 587, and maybe even 25
break;
case 'SSL':
$this->SMTPSecure = 'ssl';
$this->Port = 465;
break;
default:
if (defined('MAIL_DEBUG')) {
echo "Invalid option: {$smtp_options['secure']}<br />";
}
}
}
$this->SMTPKeepAlive = varset($smtp_options['keepalive'], FALSE);
// ***** Control this
//.........这里部分代码省略.........
示例10: __construct
/**
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
*
* @var array $overrides - array of values which override mail-related prefs. Key is the same as the corresponding pref.
* - second batch of keys can preset values configurable through the arraySet() method
* @return none
*/
public function __construct($overrides = FALSE)
{
parent::__construct(FALSE);
// Parent constructor - no exceptions for now
$e107 = e107::getInstance();
$pref = e107::pref('core');
$tp = e107::getParser();
if (defined('MAIL_DEBUG')) {
$this->debug = true;
} else {
$this->Debugoutput = 'handlePHPMailerDebug';
}
$this->pref = $pref;
$this->CharSet = 'utf-8';
$this->SetLanguage(CORE_LC);
if ($overrides === FALSE || !is_array($overrides)) {
$overrides = array();
}
foreach (array('mailer', 'smtp_server', 'smtp_username', 'smtp_password', 'sendmail', 'siteadminemail', 'siteadmin') as $k) {
if (!isset($overrides[$k])) {
$overrides[$k] = $pref[$k];
}
}
$this->pause_amount = varset($pref['mail_pause'], 10);
$this->pause_time = varset($pref['mail_pausetime'], 1);
$this->allow_html = varset($pref['mail_sendstyle'], 'textonly') == 'texthtml' ? true : 1;
if (vartrue($pref['mail_options'])) {
$this->general_opts = explode(',', $pref['mail_options'], '');
}
if ($this->debug) {
echo 'Mail_options: ' . $pref['mail_options'] . ' Count: ' . count($this->general_opts) . '<br />';
}
foreach ($this->general_opts as $k => $v) {
$v = trim($v);
$this->general_opts[$k] = $v;
if (strpos($v, 'hostname') === 0) {
list(, $this->HostName) = explode('=', $v);
if ($this->debug) {
echo "Host name set to: {$this->HostName}<br />";
}
}
}
list($this->logEnable, $this->add_email) = explode(',', varset($pref['mail_log_options'], '0,0'));
switch ($overrides['mailer']) {
case 'smtp':
$smtp_options = array();
$temp_opts = explode(',', varset($pref['smtp_options'], ''));
if (vartrue($overrides['smtp_pop3auth'])) {
$temp_opts[] = 'pop3auth';
}
// Legacy option - remove later
if (vartrue($pref['smtp_keepalive'])) {
$temp_opts[] = 'keepalive';
}
// Legacy option - remove later
foreach ($temp_opts as $k => $v) {
if (strpos($v, '=') !== FALSE) {
list($v, $k) = explode('=', $v, 2);
$smtp_options[trim($v)] = trim($k);
} else {
$smtp_options[trim($v)] = TRUE;
// Simple on/off option
}
}
unset($temp_opts);
$this->IsSMTP();
// Enable SMTP functions
if (vartrue($smtp_options['helo'])) {
$this->Helo = $smtp_options['helo'];
}
if (isset($smtp_options['pop3auth'])) {
// Need POP-before-SMTP authorisation
require_once e_HANDLER . 'phpmailer/class.pop3.php';
$pop = new POP3();
$pop->Authorise($overrides['smtp_server'], 110, 30, $overrides['smtp_username'], $overrides['smtp_password'], 1);
}
$this->Mailer = 'smtp';
$this->localUseVerp = isset($smtp_options['useVERP']);
if (isset($smtp_options['secure'])) {
switch ($smtp_options['secure']) {
case 'TLS':
$this->SMTPSecure = 'tls';
$this->Port = 465;
// Can also use port 587, and maybe even 25
break;
case 'SSL':
$this->SMTPSecure = 'ssl';
$this->Port = 465;
break;
default:
if ($this->debug) {
echo "Invalid option: {$smtp_options['secure']}<br />";
}
//.........这里部分代码省略.........
示例11: action_setregister
public function action_setregister()
{
if ($this->configs["useCaptcha"] == 1 && empty($_POST["rcaptch"])) {
echo "0::" . $this->view->getVal("l_err4");
return;
}
if (!empty($_POST["rlogin"]) && !empty($_POST["rpwd"]) && !empty($_POST["rrpwd"]) && !empty($_POST["rmail"])) {
$login = $_POST["rlogin"];
if (!preg_match("#^[aA-zZ0-9\\-_]+\$#", $login)) {
echo "0::" . $this->view->getVal("l_err1");
return;
}
$pwd = $_POST["rpwd"];
if (!preg_match("#^[aA-zZ0-9\\-_]+\$#", $pwd)) {
echo "0::" . $this->view->getVal("l_err2");
return;
}
$rpwd = $_POST["rrpwd"];
if ($pwd != $rpwd) {
echo "0::" . $this->view->getVal("l_err3");
return;
}
$email = $_POST["rmail"];
if ($this->configs["useCaptcha"] != 0) {
$cp = $_POST["rcaptch"];
if ($cp != $_SESSION["captcha_keystring"]) {
echo "0::" . $this->view->getVal("l_err4");
return;
}
unset($_SESSION["captcha_keystring"]);
}
if (!$this->model->checkLogin($login)) {
echo "0::" . $this->view->getVal("l_err5");
return;
}
//l_err7
if ($this->configs["useMail"] == 0) {
$this->model->reg($login, $pwd, $email);
echo "1::" . $this->view->getVal("l_err6");
} else {
$id = $this->model->regM($login, $pwd, $email, $this->configs["defGrp"]);
if ($id > 0) {
//region отсылаем почту
$hash = md5($id . "-=-" . $email);
$c_mail = Configs::readCfg("mail", tbuild);
require "libraries/PHPMailer/PHPMailerAutoload.php";
$pop = new POP3();
$pop->Authorise($c_mail["mailhost"], $c_mail["mailport"], $c_mail["mailtmout"], $c_mail["mailboxf"], $c_mail["mailpbf"], $c_mail["maildlvl"]);
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
// $mail->IsSMTP();
//$mail->SMTPDebug = $c_mail["maildlvl"];
$mail->Host = $c_mail["mailhost"];
$mail->SMTPAuth = true;
$mail->Username = $c_mail["mailboxf"];
$mail->Password = $c_mail["mailpbf"];
$mail->SetFrom($c_mail["mailboxf"], $c_mail["mailnamefrom"]);
$mail->AddReplyTo($c_mail["mailboxf"], $c_mail["mailnib"]);
$mail->Subject = "Register";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$this->view->set("hash", $hash . "_" . $id);
$mail->MsgHTML($this->view->out("register", "mail", 2));
$mail->AddAddress($email);
if (!$mail->Send()) {
$this->model->toLog("Mail error:" . $mail->ErrorInfo, "register", 13);
}
//endregion
echo "1::" . $this->view->getVal("l_err7");
} else {
echo "0::" . $this->view->getVal("l_err5");
}
}
}
}
示例12: icmail
function icmail($mail, $bet, $txt, $from = '', $html = false)
{
global $allgAr;
include_once 'include/includes/libs/phpmailer/class.phpmailer.php';
$mailer = new PHPMailer();
if (empty($from)) {
$mailer->From = $allgAr['adminMail'];
$mailer->FromName = $allgAr['allg_default_subject'];
} elseif (preg_match('%(.*) <([\\w\\.-]*@[\\w\\.-]*)>%i', $from, $tmp)) {
$mailer->From = trim($tmp[2]);
$mailer->FromName = trim($tmp[1]);
} elseif (preg_match('%([\\w\\.-]*@[\\w\\.-]*)%i', $from, $tmp)) {
$mailer->From = trim($tmp[1]);
$mailer->FromName = '';
}
if ($allgAr['mail_smtp']) {
// SMTP Versand
$smtpser = @db_result(db_query('SELECT `t1` FROM `prefix_allg` WHERE `k` = "smtpconf"'));
if (empty($smtpser)) {
echo '<span style="font-size: 2em; color: red;">Mailversand muss konfiguriert werden!</span><br />';
} else {
$smtp = unserialize($smtpser);
$mailer->IsSMTP();
$mailer->Host = $smtp['smtp_host'];
$mailer->SMTPAuth = $smtp['smtp_auth'] == 'no' ? false : true;
if ($smtp['smtp_auth'] == 'ssl' or $smtp['smtp_auth'] == 'tls') {
$mailer->SMTPSecure = $smtp['smtp_auth'];
}
if (!empty($smtp['smtp_port'])) {
$mailer->Port = $smtp['smtp_port'];
}
$mailer->AddReplyTo($mailer->From, $mailer->FromName);
if ($smtp['smtp_changesubject'] and $mailer->From != $smtp['smtp_email']) {
$bet = '(For ' . $mailer->FromName . ' - ' . $mailer->From . ') ' . $bet;
$mailer->From = $smtp['smtp_email'];
}
$mailer->Username = $smtp['smtp_login'];
require_once 'include/includes/libs/AzDGCrypt.class.inc.php';
$cr64 = new AzDGCrypt(DBDATE . DBUSER . DBPREF);
$mailer->Password = $cr64->decrypt($smtp['smtp_pass']);
if ($smtp['smtp_pop3beforesmtp'] == 1) {
include_once 'include/includes/libs/phpmailer/class.pop3.php';
$pop = new POP3();
$pop3port = !empty($smpt['smtp_pop3port']) ? $smpt['smtp_pop3port'] : 110;
$pop->Authorise($smpt['smtp_pop3host'], $pop3port, 5, $mailer->Username, $mailer->Password, 1);
}
}
// $mailer->SMTPDebug = true;
}
if (is_array($mail)) {
if ($mail[0] == 'bcc') {
array_shift($mail);
foreach ($mail as $m) {
$mailer->AddBCC(escape_for_email($m));
}
$mailer->AddAddress($mailer->From);
} else {
foreach ($mail as $m) {
$mailer->AddAddress(escape_for_email($mail));
}
}
} else {
$mailer->AddAddress(escape_for_email($mail));
}
$mailer->Subject = escape_for_email($bet, true);
$txt = str_replace("\r", "\n", str_replace("\r\n", "\n", $txt));
if ($html) {
$mailer->IsHTML(true);
$mailer->AltBody = strip_tags($txt);
}
$mailer->Body = $txt;
if ($mailer->Send()) {
return true;
} else {
if (is_coadmin()) {
echo "<h2 style=\"color:red;\">Mailer Error: " . $mailer->ErrorInfo . '</h2>';
}
return false;
}
}
示例13: osc_sendMail
function osc_sendMail($params)
{
// DO NOT send mail if it's a demo
if (defined('DEMO')) {
return false;
}
$mail = new PHPMailer(true);
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearAttachments();
$mail->ClearBCCs();
$mail->ClearCCs();
$mail->ClearCustomHeaders();
$mail->ClearReplyTos();
$mail = osc_apply_filter('init_send_mail', $mail, $params);
if (osc_mailserver_pop()) {
require_once osc_lib_path() . 'phpmailer/class.pop3.php';
$pop = new POP3();
$pop3_host = osc_mailserver_host();
if (array_key_exists('host', $params)) {
$pop3_host = $params['host'];
}
$pop3_port = osc_mailserver_port();
if (array_key_exists('port', $params)) {
$pop3_port = $params['port'];
}
$pop3_username = osc_mailserver_username();
if (array_key_exists('username', $params)) {
$pop3_username = $params['username'];
}
$pop3_password = osc_mailserver_password();
if (array_key_exists('password', $params)) {
$pop3_password = $params['password'];
}
$pop->Authorise($pop3_host, $pop3_port, 30, $pop3_username, $pop3_password, 0);
}
if (osc_mailserver_auth()) {
$mail->IsSMTP();
$mail->SMTPAuth = true;
} else {
if (osc_mailserver_pop()) {
$mail->IsSMTP();
}
}
$smtpSecure = osc_mailserver_ssl();
if (array_key_exists('password', $params)) {
$smtpSecure = $params['ssl'];
}
if ($smtpSecure != '') {
$mail->SMTPSecure = $smtpSecure;
}
$stmpUsername = osc_mailserver_username();
if (array_key_exists('username', $params)) {
$stmpUsername = $params['username'];
}
if ($stmpUsername != '') {
$mail->Username = $stmpUsername;
}
$smtpPassword = osc_mailserver_password();
if (array_key_exists('password', $params)) {
$smtpPassword = $params['password'];
}
if ($smtpPassword != '') {
$mail->Password = $smtpPassword;
}
$smtpHost = osc_mailserver_host();
if (array_key_exists('host', $params)) {
$smtpHost = $params['host'];
}
if ($smtpHost != '') {
$mail->Host = $smtpHost;
}
$smtpPort = osc_mailserver_port();
if (array_key_exists('port', $params)) {
$smtpPort = $params['port'];
}
if ($smtpPort != '') {
$mail->Port = $smtpPort;
}
$from = osc_mailserver_mail_from();
if (empty($from)) {
$from = 'osclass@' . osc_get_domain();
if (array_key_exists('from', $params)) {
$from = $params['from'];
}
}
$from_name = osc_mailserver_name_from();
if (empty($from_name)) {
$from_name = osc_page_title();
if (array_key_exists('from_name', $params)) {
$from_name = $params['from_name'];
}
}
$mail->From = osc_apply_filter('mail_from', $from, $params);
$mail->FromName = osc_apply_filter('mail_from_name', $from_name, $params);
$to = $params['to'];
$to_name = '';
if (array_key_exists('to_name', $params)) {
$to_name = $params['to_name'];
}
//.........这里部分代码省略.........
示例14: popbeforesmtp
function popbeforesmtp($rcpt, $header, $body, $option = "")
{
$debug_level = 0;
$pop = new POP3();
$pop->Authorise($this->config->get('pop_address'), $this->config->get('pop_port'), $this->config->get('pop_timeout'), $this->config->get('pop_username'), $this->config->get('pop_password'), $debug_level);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = $debug_level;
$mail->IsHTML(false);
$mail->Host = $this->config->get('smtp_address');
$mail->From = $this->config->get('smtp_from');
$mail->FromName = 'Anubis';
$mail->Subject = $header['subject'][1];
$mail->Body = $body;
$mail->AddAddress($rcpt, 'Anubis User');
if (!$mail->Send()) {
return $mail->ErrorInfo;
}
}
示例15: PHPMailer
<html>
<head>
<title>POP before SMTP Test</title>
</head>
<body>
<?php
require_once '../class.phpmailer.php';
require_once '../class.pop3.php';
// required for POP before SMTP
$pop = new POP3();
$pop->Authorise('192.168.0.1', 110, 30, 'jason', 'ujntfv', 1);
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\\]", '', $body);
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = '192.168.0.1';
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com", "First Last");
$mail->Subject = "PHPMailer Test Subject via POP before SMTP, basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->MsgHTML($body);
$address = "jasonwang826@gmail.com";
$mail->AddAddress($address, "John Doe");
$mail->AddAttachment("images/phpmailer.gif");
// attachment
$mail->AddAttachment("images/phpmailer_mini.gif");
// attachment
if (!$mail->Send()) {