SMTP-Authentifizierung


german 17078

SMTP-Authentifizierung

SQL importieren

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('SMTP hosts', 'EMAIL_SMTP_HOSTS', '', 'SMTP-Host Absender', '12', '6', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('SMTP-Authentifizierung', 'EMAIL_SMTP_AUTHENTICATION', 'true', 'Möchten Sie einen authentifizierten SMTP-Server?', '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 Passwort', 'EMAIL_SMTP_PASSWORD', '', 'Fügen Sie ein SMTP-Passwort für das SMTP-Protokoll hinzu', '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 Benutzer', 'EMAIL_SMTP_USER', '', 'Fügen Sie einen SMTP-Benutzer für das SMTP-Protokoll hinzu', '12', '9', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('SMTP-Antwort an', 'EMAIL_SMTP_REPLYTO', '', 'Fügen Sie der Adresse eine SMTP-Antwort E-Mailadresse hinzu', '12', '10', now());

Ersetzen Sie die folgenden 2 Dateien
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 ** */  
?>

and 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
finde:

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

Füge danach hinzu:

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

Laden Sie den PHPMailer herunter und übertragen Sie ihn per FTP auf Ihren Server im folgenden Verzeichnis:
catalog/ext/modules/

Download -> PHPMailer.zip

Durchschnitliche Gesamtbewertung
 aus 1 Bewertung
Vergeben 1 x 5  Sterne
Warum Ihre E-Mailadresse ?
Bei Bedarf werde ich Sie kontaktieren um Ihnen mit der Umsetzung zu helfen.
Ihre E-Mailadresse wird nicht öffentlich gemacht.
Ist dieser Beitrag für Sie hilfreich ?
Informationen(1)
Allgemeine Infos
 Kostenloser Werbeeintrag
Beitragszähler
Momentaner Informationsstand:
Kategorien gesamt: 9
Beiträge gesamt: 104
Supportseiten gesamt: 57
Downloads für Mitglieder: 104
Getätigte Downloads: 646
Bewertungen gesamt76
Firmenbewertungen: 34
Supportbewertungen: 35
Beitragsbewertungen: 7