1
I use the function mail in several parts of my projects, however, in an application this function sends two emails to the recipient.
I have no idea why this is happening.
Follow the full code:
<?php
include ("./incluir/conexao.php");
$vconteudo = trim($_GET['conteudo']);
$vmail = trim($_GET['emailcopia']);
$noticia_copia=mysqli_query($con,"SELECT id, slug, titulo FROM noticias WHERE id = $vconteudo GROUP BY id");
while($painel_noticias_copia=mysqli_fetch_array($noticia_copia))
{
$vid = $painel_noticias_copia['id'];
$vslug = $painel_noticias_copia['slug'];
$vtitulo = $painel_noticias_copia['titulo'];
}
$to = $vmail;
$subject = $vtitulo;
$message = "
<h1>Olá, inscrito!</h1>
<div style='font-size:17px;'>Segue uma cópia do conteúdo que você solicitou.</div><p>
<div style='font-size:17px;'>Este material foi preparado com muita dedicação.</div><p>
<div style='font-size:17px;'><b>Pug: conheça tudo sobre a origem milenar da raça</b></div><p>
<div style='font-size:17px;'>Acesse agora mesmo <a href='https://www.portalvidapet.com.br/{$vid}/{$vslug}' target='_blank'>www.portalvidapet.com.br/{$vid}/{$vslug}</a></div><p>
";
$headers = "From: Portal Vida Pet <[email protected]>\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to, $subject, $message, $headers);
$cap_email=mysqli_query($con,"SELECT email FROM captura WHERE email = '$vmail' GROUP BY email");
if (mysqli_num_rows($cap_email) < 1)
{
$painel=mysqli_query($con,"INSERT INTO captura(email) VALUES ('$vmail')");
}
?>
I think the problem is in HTML. As mentioned by Leandro, the page can be called 2x.
– Sam
the answer helped you? If yes, try to schedule it to help other colleagues.
– user148170