includes/email.php
changeset 345 4ccdfeee9a11
parent 322 5f1cd51bf1be
child 387 92664d2efab8
equal deleted inserted replaced
344:be6c5fdd9203 345:4ccdfeee9a11
    25   var $addresses, $reply_to, $from;
    25   var $addresses, $reply_to, $from;
    26   var $use_smtp;
    26   var $use_smtp;
    27 
    27 
    28   var $tpl_msg;
    28   var $tpl_msg;
    29 
    29 
    30   function emailer($use_smtp)
    30   function __construct($use_smtp)
    31   {
    31   {
    32     $this->reset();
    32     $this->reset();
    33     $this->use_smtp = $use_smtp;
    33     $this->use_smtp = $use_smtp;
    34     $this->reply_to = $this->from = '';
    34     $this->reply_to = $this->from = '';
    35   }
    35   }
   149     // Build header
   149     // Build header
   150     $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') .
   150     $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') .
   151                            (($this->from != '') ? "From: $this->from\n" : "From: " . getConfig('contact_email') . "\n") .
   151                            (($this->from != '') ? "From: $this->from\n" : "From: " . getConfig('contact_email') . "\n") .
   152                            "Return-Path: " . getConfig('contact_email') .
   152                            "Return-Path: " . getConfig('contact_email') .
   153                            "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding .
   153                            "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding .
   154                            "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) .
   154                            "\nContent-transfer-encoding: 8bit\nDate: " . enano_date('r', time()) .
   155                            "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Enano CMS\n" .
   155                            "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Enano CMS\n" .
   156                            $this->extra_headers .
   156                            $this->extra_headers .
   157                            (($cc != '') ? "Cc: $cc\n" : '')  .
   157                            (($cc != '') ? "Cc: $cc\n" : '')  .
   158                            (($bcc != '') ? "Bcc: $bcc\n" : '');
   158                            (($bcc != '') ? "Bcc: $bcc\n" : '');
   159     
   159     
   245 
   245 
   246     if ( $mimetype == "message/rfc822" )
   246     if ( $mimetype == "message/rfc822" )
   247     {
   247     {
   248       $this->mimeOut .= "From: ".$szFromAddress."\n";
   248       $this->mimeOut .= "From: ".$szFromAddress."\n";
   249       $this->mimeOut .= "To: ".$this->emailAddress."\n";
   249       $this->mimeOut .= "To: ".$this->emailAddress."\n";
   250       $this->mimeOut .= "Date: ".date("D, d M Y H:i:s") . " UT\n";
   250       $this->mimeOut .= "Date: ".enano_date("D, d M Y H:i:s") . " UT\n";
   251       $this->mimeOut .= "Reply-To:".$szFromAddress."\n";
   251       $this->mimeOut .= "Reply-To:".$szFromAddress."\n";
   252       $this->mimeOut .= "Subject: ".$this->mailSubject."\n";
   252       $this->mimeOut .= "Subject: ".$this->mailSubject."\n";
   253       $this->mimeOut .= "X-Mailer: PHP/".phpversion()."\n";
   253       $this->mimeOut .= "X-Mailer: PHP/".phpversion()."\n";
   254       $this->mimeOut .= "MIME-Version: 1.0\n";
   254       $this->mimeOut .= "MIME-Version: 1.0\n";
   255     }
   255     }
   345     while($this->p * $this->q < 255 || $this->p == $this->q)
   345     while($this->p * $this->q < 255 || $this->p == $this->q)
   346     {
   346     {
   347       $this->p = $this->primes[mt_rand(0, sizeof($this->primes)-1)];
   347       $this->p = $this->primes[mt_rand(0, sizeof($this->primes)-1)];
   348       $this->q = $this->primes[mt_rand(0, sizeof($this->primes)-1)];
   348       $this->q = $this->primes[mt_rand(0, sizeof($this->primes)-1)];
   349     }
   349     }
   350   }
       
   351   
       
   352   function EmailEncryptor()
       
   353   {
       
   354     $this->__construct();
       
   355   }
   350   }
   356   
   351   
   357   function testAll() {
   352   function testAll() {
   358     $size = sizeof($this->primes);
   353     $size = sizeof($this->primes);
   359     
   354