Changeset 460 for trunk/Common/Mail.php


Ignore:
Timestamp:
Nov 5, 2012, 10:12:56 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Odesílání emailů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Mail.php

    r438 r460  
    4141  }
    4242
     43  function AddToCombined($Address)
     44  {
     45    $this->Recipients[] = array('Address' => $Address, 'Type' => 'SendCombined');
     46  }
     47
    4348  function AddTo($Address, $Name)
    4449  {
     
    100105    foreach($this->Recipients as $Index => $Recipient)     
    101106    {
     107      if($Recipient['Type'] == 'SendCombined')
     108      {
     109        if($Index > 0) $To .= ', ';
     110        $To .= $Recipient['Address'];
     111      } else
    102112      if($Recipient['Type'] == 'Send')
    103113      {
     
    119129   
    120130    $this->Headers['Mime-Version'] = '1.0';
    121     if(count($this->Attachments) == 0)
    122     {
    123       $this->Headers['Content-Type'] = $this->Bodies[0]['Type'].'; charset='.$this->Bodies[0]['Charset'];
    124       $this->Headers['Content-Transfer-Encoding'] = $this->ContentEncoding($this->Bodies[0]['Charset']);
    125     }
    126131   
    127132    if($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
     
    169174  private function BuildAttachment($Body)
    170175  {
    171     if(count($this->Attachments > 0))
    172     {
     176    if(count($this->Attachments) > 0)
     177    {       
    173178      $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\"";
    174 
    175179      $Result = "This is a multi-part message in MIME format.\n".
    176180        "--PHP-mixed-".$this->Boundary."\n";   
     
    206210    $Result = '';
    207211    if(count($this->Bodies) > 1)
     212    {
     213      $this->Headers['Content-Type'] = 'multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"';
    208214      $Result .= 'Content-Type: multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"'.
    209215        "\n\n";
     216    } else
     217    {
     218      $this->Headers['Content-Type'] = $this->Bodies[0]['Type'].'; charset='.$this->Bodies[0]['Charset'];
     219      $this->Headers['Content-Transfer-Encoding'] = $this->ContentEncoding($this->Bodies[0]['Charset']);
     220    }
     221
    210222       
    211223    foreach($this->Bodies as $Body)
Note: See TracChangeset for help on using the changeset viewer.