Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
How to add <hr> in php mail form?

I want to add a horizontaly line


inside a form content in php. Is that possible?

I write the code below but 'hr' looks like that in my email PR1: product1 PR2: product2 < hr > PR3: product3 PR4: product4

What should I do? Thanks !!!

   <?php
    $product1= $_POST['product1'];
    $product2= $_POST['product2'];
    $product3 = $_POST['product3'];
    $product4 = $_POST['product4'];
    
    $name = $_POST['name'];
    $email = $_POST['email'];
    
  $formcontent=" From: $name \n ST1: $product1 \n PR2: $product2 <hr> \n PR3: $product3 \n PR1: $product4";
    
    $recipient = "form@mycompany.com";
    $subject = "My Products";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
    ?>
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

For <hr/> tag in your email body, you should use HTML email format, which means adding HTML tags and Content-type headers.

You can try this one

  <?php
    $product1= $_POST['product1'];
    $product2= $_POST['product2'];
    $product3 = $_POST['product3'];
    $product4 = $_POST['product4'];
    
    $name = $_POST['name'];
    $email = $_POST['email'];
    
  $formcontent="<html><body> From: $name \n ST1: $product1 \n PR2: $product2 <hr> \n PR3: $product3 \n PR1: $product4 </body></html>";
    
    $recipient = "form@mycompany.com";
    $subject = "My Products";
    $mailheader = "MIME-Version: 1.0" . "\r\n"; 
    $mailheader .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 
    $mailheader .= "From: $email \r\n";

    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
    ?>
over 4 years ago · Santiago Trujillo Relatório

0

put content below or above following div

<div style='width:100%; height : 13px; float:left; border-bottom : 1px solid black;'>&nbsp;</div>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda