R
R
rinatoptimus2015-10-06 15:53:13
PHP
rinatoptimus, 2015-10-06 15:53:13

How to send data to 2 mailboxes?

The page has a form for submitting data, if I'm not mistaken, this code is responsible for this:

$args = array(
      'key' => 'какой-то ключ,
      'message' => array(
        "html" => null,
        "text" => 'Заявка с сайта сайт.ru. '.print_r($_POST,true), 
        "from_email" => 'какая-то почта',
        "from_name" => 'Заявка',
        "subject" => 'У вас новая заявка',
        "to" => array(array('еmail'=>'еще почта'))				
        
      )
    );
    
    mail($args['message']['to'][0]['email'],$args['message']['subject'],$args['message']['text']);

I tried to add another box, so that information goes there:
"to" => array(array('еmail'=>'еще почта', 'доп. почта'))
и так:
"to" => array(array('еmail'=>'еще почта', 'еmail'=>'доп. почта'))

Or do I need to create an entire array for this? Type:
$args = array(
      'key' => 'какой-то ключ,
      'message' => array(
        "html" => null,
        "text" => 'Заявка с сайта сайт.ru. '.print_r($_POST,true), 
        "from_email" => 'какая-то почта',
        "from_name" => 'Заявка',
        "subject" => 'У вас новая заявка',
        "to" => array(array('еmail'=>'еще почта'))				
        
      )
    );
    
    mail($args['message']['to'][0]['email'],$args['message']['subject'],$args['message']['text']);

// второй массив
$args-second = array(
      'key' => 'какой-то ключ,
      'message' => array(
        "html" => null,
        "text" => 'Заявка с сайта сайт.ru. '.print_r($_POST,true), 
        "from_email" => 'какая-то почта',
        "from_name" => 'Заявка',
        "subject" => 'У вас новая заявка',
        "to" => array(array('еmail'=>'еще почта'))				
        
      )
    );
    
    mail($args-second['message']['to'][0]['email'],$args-second['message']['subject'],$args-second['message']['text']);

The task is probably simple for knowledgeable people?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Novikov, 2015-10-06
@dmitriy_novikov

www.php.su/mail

/* получатели */
$to= "Mary <[email protected]>" . ", " ; //обратите внимание на запятую
$to .= "Kelly <[email protected]>";


/*...*/
mail($to, $subject, $message, $headers);

those. the list of addresses to send is not an array, but simply a listing of addresses separated by commas.

R
rinatoptimus, 2015-10-06
@rinatoptimus

But my code (not written by me) looks different, and what does array mean in it if it's not an array?
"to" => array(array('еmail'=>'[email protected]'))
and further:
mail($args['message']['to'][0]['email'].. .

N
Nastya, 2015-10-07
@nastyamyaots

Try to write "to" => array(array('email'=>'[email protected], [email protected]')), where [email protected] will be another address you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question