0
I need the contact form to be sent to 2 different emails, the PHP code is working right, I just need to know where to insert the 2nd destination email:
<?php
$nome = $_POST['nome'];
$idade = $_POST['idade'];
$inst = $_POST['instituto'];
$imersao = $_POST['imersao'];
$email = $_POST['email'];
$fone = $_POST['fone'];
$facebook = $_POST['facebook'];
$cidade = $_POST['cidade'];
$msg = $_POST['mensagem'];
$headers = "From: ". $nome;
$corpoemail = 'Contato Via site
Nome: ' .$nome.'
Idade: ' .$idade.'
Como conheceu o Instituto: ' .$inst.'
Já fez nossa Imersão: ' .$imersao.'
Email: ' .$email.'
Fone: ' .$fone.'
Facebook: ' .$facebook.'
Cidade: ' .$cidade.'
Mensagem: '.$msg.' ';
if(mail("[email protected]", "Cadastro Via Site",$corpoemail,$headers)){
echo "<script>alert('Cadastro enviado com sucesso!');document.location='index.php';</script>";
} else{
echo "<script>alert('Erro ao enviar, tente diretamente pelo [email protected]');</script>";
}
I did several tests, with several different emails, the form only arrives for the 1st e-mail...
– Clayton
Unlikely, but may be a limitation of your mail server to prevent spam
– Leandro Angelo
@Clayton, you can try adding CC or BCC to the header
– Leandro Angelo
the code is right there as it is in the comment?
– Clayton
@Clayton at first yes.
– Leandro Angelo
It really must be something on the hosting server, because the main email is showing that a copy ( CC ) was sent to the second email, but the second email does not receive...
– Clayton