слать копию письма на 2й email

Статус
В этой теме нельзя размещать новые ответы.

ufaclub

Полезный
Регистрация
1 Май 2007
Сообщения
395
Реакции
19
PHP:
 $address = "mail@name.ru";
$sub = "$d1 $d2 → из $d6 в $d20 ";
$mes = "

как сделать чтоб и на mail@name.ru и на mail2@name.ru
уходила копия письма
 
Попробуй так
PHP:
 $address = "mail@name.ru , ";
 $address .= "mail2@name.ru";
$sub = "$d1 $d2 → из $d6 в $d20 ";
$mes = "

или так еще попробуй
PHP:
 $address = "mail@name.ru, mail2@name.ru";
 
  • Заблокирован
  • #5
Будьте осторожны, очень многие спам-фильтры без разбору принимают спамом письма, у которых не один адресат.
 
Как вариант просто два раза вызывать функцию мейл. Просто и надежно. ;)
 
простой класс
в переменную BCC адреса копий)

PHP:
<?php
/**
 * $Revision: 11 $
 * $Author: CrashX $
 * $Date: 2010-02-02 14:27:01 +0600 (Вт, 02 фев 2010)$
 * $Id: email.php 11 2010-02-02 08:52:10Z CrashX $
 * Copyright © CrashX <XSiteCMS@gmail.com>
 * Всі права захищено © CrashX
 */

class Email {

  var $www    =WWW;
  var $mailer =PRODUCT;
  var $from   ="";
  var $to     ="";
  var $subject="";
  var $message="";
  var $error  ="";
  var $bcc    =array();
  var $header ="";
  var $html   =0;
  var $charset=CHARSET;
  var $eol    ="\n";

  function headers() {
    $this->subject = "=?".$this->charset."?b?" . base64_encode($this->subject). "?=";
    $from = "=?".$this->charset."?b?" . base64_encode($this->www). "?=";

    if($this->html):
      $this->header .= "MIME-Version: 1.0".$this->eol;
      $this->header .= "Content-type: text/html; charset=\"".$this->charset."\"".$this->eol;
    else:
      $this->header .= "MIME-Version: 1.0".$this->eol;
      $this->header .= "Content-type: text/plain; charset=\"".$this->charset."\"".$this->eol;
    endif;

    if(count($this->bcc)):
      $this->header .= "Bcc: ".implode( "," , $this->bcc ) . $this->eol;
    endif;
    $this->header .= "Subject: ".$this->subject.$this->eol;
    if($this->to):
      $this->header .= "To: ".$this->to.$this->eol;
    endif;

    $this->header .= "From: \"".$from."\" <".$this->from.">".$this->eol;
    $this->header .= "Return-Path: <".$this->from.">".$this->eol;
    $this->header .= "X-Priority: 3".$this->eol;
    $this->header .= "X-Mailer: ".$this->mailer.$this->eol;
  }
  function send() {
    $this->to   = preg_replace( "/[ \t]+/" , ""  , $this->to   );
    $this->from = preg_replace( "/[ \t]+/" , ""  , $this->from );

    $this->to   = preg_replace( "/,,/"     , ","  , $this->to );
    $this->from = preg_replace( "/,,/"     , ","  , $this->from );

    $this->to     = '<'.preg_replace( "#\#\[\]'\"\(\):;/\$!Ј%\^&\*\{\}#" , "", $this->to  ).'>';
    $this->from   = preg_replace( "#\#\[\]'\"\(\):;/\$!Ј%\^&\*\{\}#" , "", $this->from);
    $this->message   = str_replace( "\r" , "", $this->message);

    $this->headers();

    if(!preg_match( "/^<.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)>$/", $this->to )):
      $this->error="E-Mail: {$this->to} not valid";
      $this->send=false;
    endif;

    if(($this->to) and ($this->from) and ($this->subject)):
      if(!@mail( $this->to, $this->subject, $this->message, $this->header )):
        $this->error="PHP Mail Error.";
        $this->send=false;
      endif;
    endif;
    $this->header="";
  }
  function reset() {
    $this->www    =WWW;
    $this->mailer =PRODUCT;
    $this->from   ="";
    $this->to     ="";
    $this->subject="";
    $this->message="";
    $this->error  ="";
    $this->bcc    =array();
    $this->header="";
    $this->html   =0;
    $this->charset=CHARSET;
  }

}
?>
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху