Jump to content
Fórum Script Brasil
  • 0

$cabecalho .= "From: $email";


quinhosp

Question

Boa tarde galera!

Estou com um problema aqui e gostaria de obter ajuda!

no código abaixo a variável cabeçalho não envia o email de outros servidores para caixa de entrada. Isso só acontece se eu inserir por exemplo jamir@teste.com.br.

Desde já grato.

<?php

//pega as variaveis por POST
$email =     $_POST["email"];

$data      = date("d/m/y");                     //fun��o para pegar a data de envio do e-mail
$hora      = date("H:i");                       //para pegar a hora com a fun��o date

$email = $_POST["email"];
$email = str_replace (" ", "", $email);
$email = str_replace ("/", "", $email);
$email = str_replace ("@.", "@", $email);
$email = str_replace (".@", "@", $email);
$email = str_replace (",", ".", $email);
$email = str_replace (";", ".", $email);
$erro=0;

if (empty($email)) 
{
    $erro=1;
echo "&lt;script>alert(\"PREENCHIMENTO OBRIGATORIO DO CAMPO EMAIL.\");</script>";
    echo "&lt;script>
    location.href='index.html'
    </script>";
}

if(strlen($email)<8 || substr_count($email, "@")!=1 || substr_count($email, ".")==0)
{
$erro=1;
echo "&lt;script>alert(\"EMAIL INVALIDO!\");</script>";
    echo "&lt;script>
    location.href='index.html'
    </script>";
}
if($erro==0)
{    

$msg .= "CADASTRO DE EMAIL - SITE JAMIR<br><br>";
$msg .= "Email: $email<br>";
$msg .= "Data: $data - $hora<br><br>";
    
    $cabecalho = "Content-type: text/html; charset=UTF-8\r\n";
    $cabecalho .= "From: $email";

mail("jamir@gmail.com.br", "Cadastro de Email", $msg, $cabecalho);
echo "&lt;script>alert(\"Cadastro realizado com sucesso. Obrigado!\");</script>";
    echo "&lt;script>
    location.href='index.html'
    </script>";
}
?>

Edited by quinhosp
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...