Uwierzytelnianie SMTP


polish 2961
Importuj SQL
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('SMTP hosts', 'EMAIL_SMTP_HOSTS', '', 'Nadawca hosta SMTP', '12', '6', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Uwierzytelnianie SMTP', 'EMAIL_SMTP_AUTHENTICATION', 'true', 'Czy chcesz uwierzytelnionego serwera SMTP?', '12', '7', 'tep_cfg_select_option(array('true', 'false'), ', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('SMTP hasło', 'EMAIL_SMTP_PASSWORD', '', 'Dodaj hasło SMTP dla protokołu SMTP', '12', '8', 'tep_cfg_password', 'tep_cfg_input_password(', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('SMTP użytkownik', 'EMAIL_SMTP_USER', '', 'Dodaj użytkownika SMTP dla protokołu SMTP', '12', '9', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Odpowiedź SMTP', 'EMAIL_SMTP_REPLYTO', '', 'Dodaj adres e-mail odpowiedzi SMTP do adresu', '12', '10', now());

Zastąp następujące 2 pliki
catalog/includes/classes/email.php

<?php
/*
  $Id$
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2014 osCommerce
    
*/
  require_once 'ext/modules/PHPMailer/class.phpmailer.php';
  $phpMail = new PHPMailer();
  class email {
    var $html;
    var $text;
    var $html_text;
    var $lf;
    var $debug = 0;
    var $debug_output = 'error_log';
    function email($headers = '') {
      global $phpMail;
      $phpMail->XMailer = 'YePix ' . tep_get_version();
      $phpMail->SMTPDebug = $this->debug;
      $phpMail->Debugoutput = $this->debug_output;
      $phpMail->CharSet = CHARSET;
      $phpMail->WordWrap = 998;
      if (EMAIL_LINEFEED == 'CRLF') {
        $this->lf = "rn";
      } else {
        $this->lf = "n";
      }
    }
    function add_text($text = '') {
      global $phpMail;
      $phpMail->IsHTML(false);
      $this->text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
    }
    function add_html($html, $text = NULL, $images_dir = NULL) {
      global $phpMail;
      $phpMail->IsHTML(true);
      $this->html = tep_convert_linefeeds(array("rn", "n", "r"), '<br>', $html);
      $this->html_text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
      if (isset($images_dir)) $this->html = $phpMail->msgHTML($this->html, $images_dir);
    }
    function add_attachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') {
      global $phpMail;
      $phpMail->AddAttachment($path, $name, $encoding, $type, $disposition);
    }
    function build_message() {
      //out of work function
    }
    function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $reply_to = false) {
      global $phpMail;
      if ((strstr($to_name, "n") != false) || (strstr($to_name, "r") != false)) {
        return false;
      }
      if ((strstr($to_addr, "n") != false) || (strstr($to_addr, "r") != false)) {
        return false;
      }
      if ((strstr($subject, "n") != false) || (strstr($subject, "r") != false)) {
        return false;
      }
      if ((strstr($from_name, "n") != false) || (strstr($from_name, "r") != false)) {
        return false;
      }
      if ((strstr($from_addr, "n") != false) || (strstr($from_addr, "r") != false)) {
        return false;
      }
      $phpMail->From = $from_addr;
      $phpMail->FromName = $from_name;
      $phpMail->AddAddress($to_addr, $to_name);
      if ($reply_to) {
        $phpMail->AddReplyTo(EMAIL_SMTP_REPLYTO, STORE_NAME);
      } else {
        $phpMail->AddReplyTo($from_addr, $from_name);
      }
      $phpMail->Subject = $subject;
      if (!empty($this->html)) {
        $phpMail->Body = $this->html;
        $phpMail->AltBody = $this->html_text;
      } else {
        $phpMail->Body = $this->text;
      }
      if (EMAIL_TRANSPORT == 'smtp' || EMAIL_TRANSPORT == 'gmail') {
        $phpMail->IsSMTP();
        $phpMail->Host = EMAIL_SMTP_HOSTS;
        $phpMail->SMTPAuth = EMAIL_SMTP_AUTHENTICATION;
        $phpMail->Username = EMAIL_SMTP_USER;
        $phpMail->Password = EMAIL_SMTP_PASSWORD;
        if (EMAIL_TRANSPORT == 'gmail') {
          $phpMail->Port = 465;
          $phpMail->SMTPSecure = 'ssl';
        }
      } else {
        $phpMail->isSendmail();
      }
      if (!$phpMail->Send()) {
        return false;
      }
      $phpMail->clearAddresses();
      return true;
    }
  }
/* ** Altered for Mail Manager ** */
// eliminate line feeds as <br>
  class emailMailManager extends email { 
	function add_html($html, $text = NULL, $images_dir = NULL) {
	  $this->html = $html; //tep_convert_linefeeds(array("rn", "n", "r"), '<br>', $html);
	  $this->html_text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
	  if (isset($images_dir)) $this->find_html_images($images_dir);
	}
  }
/* ** EOF alterations for Mail Manager ** */  
?>

i catalog/admin/includes/classes/email.php

<?php
/*
  $Id$
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2014 osCommerce
  Released under the GNU General Public License
  
*/
  require_once '../ext/modules/PHPMailer/PHPMailerAutoload.php';
  $phpMail = new PHPMailer();
  class email {
    var $html;
    var $text;
    var $html_text;
    var $lf;
    var $debug = 0;
    var $debug_output = 'error_log';
    function email($headers = '') {
      global $phpMail;
      $phpMail->XMailer = 'YePix ' . tep_get_version();
      $phpMail->SMTPDebug = $this->debug;
      $phpMail->Debugoutput = $this->debug_output;
      $phpMail->CharSet = CHARSET;
      $phpMail->WordWrap = 998;
      if (EMAIL_LINEFEED == 'CRLF') {
        $this->lf = "rn";
      } else {
        $this->lf = "n";
      }
    }
    function add_text($text = '') {
      global $phpMail;
      $phpMail->IsHTML(false);
      $this->text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
    }
    function add_html($html, $text = NULL, $images_dir = NULL) {
      global $phpMail;
      $phpMail->IsHTML(true);
      $this->html = tep_convert_linefeeds(array("rn", "n", "r"), '<br>', $html);
      $this->html_text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
      if (isset($images_dir)) $this->html = $phpMail->msgHTML($this->html, $images_dir);
    }
    function add_attachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') {
      global $phpMail;
      $phpMail->AddAttachment($path, $name, $encoding, $type, $disposition);
    }
    function build_message() {
      //out of work function
    }
    function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {
      global $phpMail;
      if ((strstr($to_name, "n") != false) || (strstr($to_name, "r") != false)) {
        return false;
      }
      if ((strstr($to_addr, "n") != false) || (strstr($to_addr, "r") != false)) {
        return false;
      }
      if ((strstr($subject, "n") != false) || (strstr($subject, "r") != false)) {
        return false;
      }
      if ((strstr($from_name, "n") != false) || (strstr($from_name, "r") != false)) {
        return false;
      }
      if ((strstr($from_addr, "n") != false) || (strstr($from_addr, "r") != false)) {
        return false;
      }
      $phpMail->From = $from_addr;
      $phpMail->FromName = $from_name;
      $phpMail->AddAddress($to_addr, $to_name);
      if ($reply_to ?? null) {
        $phpMail->AddReplyTo(EMAIL_SMTP_REPLYTO, STORE_NAME);
      } else {
        $phpMail->AddReplyTo($from_addr, $from_name);
      }
      $phpMail->Subject = $subject;
      if (!empty($this->html)) {
        $phpMail->Body = $this->html;
        $phpMail->AltBody = $this->html_text;
      } else {
        $phpMail->Body = $this->text;
      }
      if (EMAIL_TRANSPORT == 'smtp' || EMAIL_TRANSPORT == 'gmail') {
        $phpMail->IsSMTP();
        $phpMail->Host = EMAIL_SMTP_HOSTS;
        $phpMail->SMTPAuth = EMAIL_SMTP_AUTHENTICATION;
        $phpMail->Username = EMAIL_SMTP_USER;
        $phpMail->Password = EMAIL_SMTP_PASSWORD;
        if (EMAIL_TRANSPORT == 'gmail') {
          $phpMail->Port = 465;
          $phpMail->SMTPSecure = 'ssl';
        }
      } else {
        $phpMail->isSendmail();
      }
      if (!$phpMail->Send()) {
        return false;
      }
      $phpMail->clearAddresses();
      return true;
    }
  }
  /* ** Altered for Mail Manager ** */
  // eliminate line feeds as <br>
  class emailMailManager extends email { 
	function add_html($html, $text = NULL, $images_dir = NULL) {
	  $this->html = $html; //tep_convert_linefeeds(array("rn", "n", "r"), '<br>', $html);
	  $this->html_text = tep_convert_linefeeds(array("rn", "n", "r"), $this->lf, $text);
	  if (isset($images_dir)) $this->find_html_images($images_dir);
	}
  }
  /* ** EOF alterations for Mail Manager ** */
?>

catalog/admin/includes/functions/general.php
Znajdź:

  function tep_call_function($function, $parameter, $object = '') {
    if ($object == '') {
      return call_user_func($function, $parameter);
    } else {
      return call_user_func(array($object, $function), $parameter);
    }
  }

Dodaj poniźej:

function tep_cfg_password($password) {
return preg_replace("|.|", "*", $password);
}
function tep_cfg_input_password($password) {
return tep_draw_password_field('configuration_value', $password);
} 

Pobierz PHPMailer i przeÅ›lij go poprzez FTP na swój serwer w nastÄ™pujÄ…ce miejsce:
catalog/ext/modules/

Download -> PHPMailer.zip
Dlaczego Twój adres e-mail?
W razie potrzeby skontaktuję się z Tobą, aby pomóc Ci we wdrożeniu.
Twój adres e-mail nie zostanie upubliczniony.
Czy ten post jest dla Ciebie pomocny?
Średnia ogólna ocena
 z 1 Ocena
Nagrodzono 1 x 5  Gwiazdkek
Informacja(2)
Informacje ogólne
 BezpÅ‚atny wpis reklamowy
 Lazy Loading
Licznik postów
Aktualny stan informacji:
Kategorie: 8
Posty: 104
Strony wsparcia: 54
Pobieranie dla członków: 104
Licznik pobierania: 646
Wszystkie recenzje58
Firmy: 26
Wsparcie: 25
Informacje: 7