phpDocumentor PHPShopClass
[ class tree: PHPShopClass ] [ all elements ]

Source for file mail.class.php

Documentation is available at mail.class.php

  1. <?php
  2. /**
  3.  * Библиотека Отправление почты
  4.  * @version 1.0
  5.  * @package PHPShopClass
  6.  * <code>
  7.  * // example:
  8.  * $PHPShopMail= new PHPShopMail('user@localhost','admin@localhost'','Test','Hi, user!');
  9.  * </code>
  10.  * @param string $to куда
  11.  * @param string $from от кого
  12.  * @param string $zag заголовок письма
  13.  * @param string $content содежание письма
  14.  */
  15. class PHPShopMail {
  16.     /**
  17.      * @var string кодировка письма
  18.      */
  19.     var $codepage="windows-1251";
  20.     /**
  21.      * @var string MIME тип
  22.      */
  23.     var $mime  = "1.0";
  24.     /**
  25.      * @var string Тип содержания
  26.      */
  27.     var $type = "text/plain";
  28.     /**
  29.      * Конструктор
  30.      * @param string $to куда
  31.      * @param string $from от кого
  32.      * @param string $zag заголовок письма
  33.      * @param string $content содежание письма
  34.      */
  35.     function PHPShopMail($to,$from,$zag,$content{
  36.         $this->from=$from;
  37.         $this->zag="=?".$this->codepage."?B?".base64_encode($zag)."?=";
  38.         $this->to=$to;
  39.         $header=$this->getHeader();
  40.         $this->sendMail($content,$header);
  41.     }
  42.     /**
  43.      * Заголовок письма
  44.      * @return string
  45.      */
  46.     function getHeader({
  47.         $header "MIME-Version: ".$this->mime."\n";
  48.         $header.= "From:   <".$this->from.">\n";
  49.         $header.= "Content-Type: ".$this->type."; charset=".$this->codepage."\n";
  50.         $header.= "Content-Transfer-Encoding: 8bit\n";
  51.         return $header;
  52.     }
  53.     /**
  54.      * Отправление письма через php mail
  55.      * @param string $content содержание
  56.      * @param strong $header заголовок
  57.      */
  58.     function sendMail($content,$header{
  59.         mail($this->to,$this->zag,$content,$header);
  60.     }
  61.     /**
  62.      * Вставка копирайта
  63.      * @return string
  64.      */
  65.     function getCopyright({
  66.         $s="
  67.      
  68.      
  69. Powered & Developed by www.PHPShop.ru
  70. ".$GLOBALS['SysValue']['license']['product_name'];
  71.         return $s;
  72.     }
  73. }
  74. ?>

Documentation generated on Mon, 25 Jun 2012 15:09:47 +0400 by phpDocumentor 1.4.3