表单被重定向到正确的第二页,但我没有收到发送到的电子邮件中的信息


Form is been redirected to the correct 2nd page but i don't receive the info in emails where is sent to

我有一个名为formulario.html的html表单,当他提交并成功时,它被重定向到名为agradecimentos.html的第二页。一切都很顺利,但我没有收到他发送的两封邮件中表单的信息。提前感谢您的帮助。

下面是formulario.html代码的一部分:

<form action="suporte_email.php" method="post" name="formulario" id="formulario" >
<!-- THAT'S TOO MUCH CODE BUT I CHECKED THAT AND IT SEEMS NOT TO BE WRONG -->
<input type="submit" name="submit" class="button" value="Enviar" />
</form>
agradecimentos.html是一个简单的html代码,它将客户端从站点重定向到一个页面。

我的.php代码被命名为suporte_email.php,就像你可以看到的那样。我的问题是我没有从表格中收到信息,我仍然不知道我的错误在哪里。

suporte_email.php

<?php
$crlf = "'r'n";
//Get Data
    $nome = $_POST['nome'];                    
    $empresa = $_POST['empresa'];              
    $contacto = $_POST['contacto'];            
    $email = $_POST['email'];                  
    $marca = $_POST['marca'];                   
    $other = $_POST['other'];                    
    $serial_number = $_POST['serial_number'];     
    $garantia = $_POST['garantia'];               
    $contrato = $_POST['contrato'];             
    $permissoes = $_POST['permissoes'];           
    $descricao_avaria = $_POST['descricao_avaria'];
    $checkbox = $_POST["checkbox"];
    $radio = $_POST["radio"];
 // Parse/Format/Verify Data
       $to      = "teste@teste.pt, $email"; 
       $from    = "Suporte";
       $subject = "Formulário de Suporte";
       $email_body = "$crlf De: $nome$crlf Email: $email$crlf Assunto: $subject$crlf$crlf Empresa: $empresa$crlf Contacto: $contacto$crlf Marca: $marca$crlf Outra: $other$crlf Número de Série: $serial_number$crlf Garantia: $radio$crlf Contrato: $checkbox$crlf Tipo de Suporte: $permissoes$crlf$crlf Descrição da Avaria: $descricao_avaria";
       // Setup EMAIL headers, particularly to support UTF-8
       // We set the EMAIL headers here, these will be sent out with your message
       // for the receiving email client to use.
       $headers ='From: '.$to . $crlf . 
                  'Reply-To: ' .$to  . $crlf . 
                  'Content-Type: text/plain; charset=UTF-8' .  $crlf .
                  'X-Mailer: PHP/' . phpversion();

       // Then we pass the headers into our mail function
       mail($to, $from, $subject, $email_body, $headers);
       header('Location: agradecimentos.html');
?>

//Garantia是单选按钮,contrto是复选框

your

 mail($to, $from, $subject, $email_body, $headers);
应该

 mail($to, $subject, $email_body, $headers);

mail(to,subject,message,headers,parameters);
PHP mail() Function

添加FromCc选项应为

$headers = "From: webmaster@example.com" . "'r'n" .
           "CC: somebodyelse@example.com";

添加html版本应该像这样

$headers = "MIME-Version: 1.0" . "'r'n";
$headers .= "Content-type:text/html;charset=UTF-8" . "'r'n";

编辑01

        $email_body = "De: $nome
        'r'n Email: $email
        'r'n Assunto: $subject
        'r'n Empresa: $empresa
        'r'n Contacto: $contacto
        'r'n Marca: $marca
        'r'n Outra: $other
        'r'n Número de Série: $serial_number
        'r'n Garantia: $radio
        'r'n Contrato: $checkbox
        'r'n Tipo de Suporte: $permissoes
        'r'n Descrição da Avaria: $descricao_avaria";