How to make a form send email to 2 recipients?

0

I've created a form where the user fills in with some information and an email is sent to me with this information. Only at the moment it is only sending to 1 email.

Below is the code:

  <?php
header('Content-Type: text/html; charset=utf-8');
header ("location: sucesso.html");
$radio=$_POST[radio];
$nome=$_POST[nome];
$num=$_POST[num];
$mes=$_POST[mes];
$aviso=$_POST[aviso];
$email=$_POST[email];
$assunto=$_POST[assunto];
$mensagem=$_POST[mensagem];

mail("[email protected]","Chegou um e-mail","
Campo 1: $radio
Campo 2: $num
Campo 3: $nome
Campo 4: $mes
Campo 7: $aviso 
");

echo "sua mensagem foi enviada com sucesso!";

?>
  

How do I send the emails to another recipient, only (hidden)?

In case he should send the emails to a common email, and another to a hidden email.

    
asked by anonymous 29.05.2015 / 08:39

1 answer

1

The hidden email you enter in the header of the message, eg:

// Vários 'para' separados por vírgula
$para  = '[email protected]' . ', ';
$para .= '[email protected]';

// Assunto
$assunto= 'Assunto';

// Mensagem
$mensagem = "Alguma mensagem";

// Headers
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Headers Adicionais
$headers .= 'To: Alguem <[email protected]>, Fulano <[email protected]>' . "\r\n";
$headers .= 'From: Mim <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n"; // Com cópia
$headers .= 'Bcc: [email protected]' . "\r\n"; // Cópia oculta

// Enviar
mail($para, $assunto, $menssagem, $headers);

More information: link

    
29.05.2015 / 12:58