Fiz dowload de um formulário PHP para envio de dados ao meu email, mas não recebo nada, apesar de sempre aparecer que a a "Mensagem foi Enviada com Sucesso". Inclusive tentei outros formulários, mas todos aconteceram a mesma coisa.
Alguém poderia me dar uma luz? Segue o código abaixo. Obrigado.
<!--OPTIONAL: (otherwise leave empty) template2 file location (return sender (acknowledgement) only: works when the sender has filled in his email adress )-->
Pergunta
Sem Ladainha
Boa noite...
Fiz dowload de um formulário PHP para envio de dados ao meu email, mas não recebo nada, apesar de sempre aparecer que a a "Mensagem foi Enviada com Sucesso". Inclusive tentei outros formulários, mas todos aconteceram a mesma coisa.
Alguém poderia me dar uma luz? Segue o código abaixo. Obrigado.
"FORM.HTML"
<BODY ONLOAD="document.formname.name.focus()">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#003399">
<td width="1269" height="19" colspan="3" bgcolor="#CC0033"><div align="center"><img src="../imagens/titulo.jpg" width="700" height="90"></div></tr>
<tr bgcolor="#003399">
<td height="19" colspan="3"> </tr>
<tr>
<td height="322" colspan="3"> <div align="justify">
<FORM NAME="formname" METHOD=POST ACTION="form.php">
<!-- to actionfile for the script -->
<!--form, make one as pleased with own fields and variables below.... -->
<p> </p>
<p align="center"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Nome</font><br>
<INPUT TYPE=TEXT NAME="name" SIZE=30>
<BR>
<BR>
<font size="3" face="Verdana, Arial, Helvetica, sans-serif">Endereço</font><br>
<INPUT TYPE=TEXT NAME="adress" SIZE=30>
<BR>
<BR>
<font size="3" face="Verdana, Arial, Helvetica, sans-serif">E-mail</font><br>
<INPUT TYPE=TEXT NAME="email" SIZE=30>
<BR>
<BR>
<font size="3" face="Verdana, Arial, Helvetica, sans-serif">Mensagem</font><br>
<TEXTAREA NAME="textfield" WRAP="physical" COLS="50" ROWS="8"></TEXTAREA>
<BR>
<BR>
<!--COPY below to your form (or use this one)-->
<!--params below must be used -->
<INPUT TYPE=HIDDEN NAME=F_FROM VALUE=" Sem Ladainha ">
<!--from- line for email -->
<INPUT TYPE=HIDDEN NAME=F_TO VALUE="semladainha@yahoo.com.br,semladainha@hotmail.com">
<!--to- line for email: your/owner website adress -->
<INPUT TYPE=HIDDEN NAME=F_SUBJECT VALUE="E-mail enviado ao Sem Ladainha">
<!--subject- line for email -->
<INPUT TYPE=HIDDEN NAME=F_TEMPLATE VALUE="template.txt">
<!--template file location -->
<INPUT TYPE=HIDDEN NAME=F_TEMPLATE2 VALUE="template2.txt">
<!--OPTIONAL: (otherwise leave empty) template2 file location (return sender (acknowledgement) only: works when the sender has filled in his email adress )-->
<INPUT TYPE=HIDDEN NAME=F_SENT VALUE="sent_ok.html">
<!--form to go to after successfully sending the form-->
<INPUT TYPE=HIDDEN NAME=F_NOTSENT VALUE="sent_notok.html">
<!--form to go to after errors with sending the form-->
<!--END-COPY -->
<INPUT TYPE=SUBMIT VALUE=" Enviar ">
</p>
</FORM>
</div></td>
</tr>
</table>
</body>
"FORM.PHP"
<?php
function file2go2($url){ print "<html>\n<head>\n<meta http-equiv=\"refresh\" content=\"0;URL=$url\">\n</head>\n</html>"; exit; }
if(!@fopen($F_TEMPLATE, "r")) file2go2($F_NOTSENT);
else $arr_t1 = @file( $F_TEMPLATE ); $nr_mail = 1;
if (! $F_TEMPLATE2 == "" && !@fopen($F_TEMPLATE2, "r")) file2go2($F_NOTSENT);
if (! $F_TEMPLATE2 == "" && @fopen($F_TEMPLATE2, "r")) $arr_t2 = @file( $F_TEMPLATE2 ); $nr_mail = 2;
$domail = 1;
while ($domail <= $nr_mail):
if ($domail == 1) $var2use = $arr_t1; else $var2use = $arr_t2;
for ($index = 0; $index < count($var2use); $index++)
{
$pattern = ereg("{{[A-z0-9_]*}}", $var2use[$index]);
if ($pattern)
{
$line = ereg_replace("{{","$",$var2use[$index]);
$line = ereg_replace("}}","",$line);
}
else
{
$line = $var2use[$index];
}
$line = addslashes($line) . "<br>";
eval( "\$line = \"$line\";" );
if ($index == 0 && $domail == 1) $linetot1 = $line;
elseif ($index > 0 && $domail == 1) $linetot1 .= $line;
if ($index == 0 && $domail == 2) $linetot2 = $line;
elseif ($index > 0 && $domail == 2) $linetot2 .= $line;
}
++$domail;
endwhile;
//the next line will email the 1st template to $F_TO of your form (normally yourself c.q. the owner of website)
$mailit1 = @mail($F_TO, $F_SUBJECT, $linetot1, "From: $F_FROM \nMime-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 7bit");
//the next (optional) line will email the sender if he filled in his email in the form:
//change the $email to the variable name in your form (the email adress of the visitor)
//only do this when you want 2 templates emailed. Otherwise put two slashes in front of the next line ( // )
//ALSO: if you want to be able to reply directly to the sender, then change $F_FROM in the next line to $email.
if ($nr_mail == 2) $mailit2 = @mail($email, $F_SUBJECT, $linetot2, "From: $F_FROM\nMime-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 7bit");
//if you encounter problems with html-formatting of the mail then remove the following in the appropraite 2 lines above:
//\nMime-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 7bit
//do not remove the "); after that!
if ($mailit1 = true) $sent = 1;
else $sent = 0;
if ($mailit2 = true) $sent = 2;
else $sent = 0;
if ($nr_mail == 1 && $sent == 1) file2go2($F_SENT);
if ($nr_mail == 1 && $sent == 0) file2go2($F_NOTSENT);
if ($nr_mail == 2 && $sent == 2) file2go2($F_SENT);
if ($nr_mail == 2 && $sent == 0) file2go2($F_NOTSENT);
?>
Editado por Sem LadainhaLink para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.