No servidor online funciona perfeitamente mas no meu computador (localhost) não funciona, é mostrada a mensagem abaixo:
Warning: mail() [function mail]: SMTP server response 501 5.5.2 MAIL FROM syntax error in (arquivo) on line (25 e 26)
As linhas são:
mail($para,$assunto,$pedido,$cabecalho);
mail($email,$assunto_resposta,$pedido_resposta,$cabecalho_resposta);
O PHP.INI está assim:
[mail function]
; For Win32 only.
SMTP = smtp.xxxxxx.com.br
smtp_port = 25
; For Win32 only.
sendmail_from = xxxx@xxx.com.br
sendmail_from = trialkey
O arquivo completo está abaixo:
<?php
session_start();
if($_POST['captcha'] == $_SESSION['session_textoCaptcha'])
{
$ip=$_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$de = "xxxxxx@xxxxxx";
$para = "xxxxx@xxx";
$assunto = "Pedido";
$assunto_resposta = "Re: Pedido";
$cabecalho = "MIME-Version: 1.0\r\n".
"Content-type: text/html; charset=ISO-8859-1\r\n".
"From: \"WebMaster\" <".$de.">\r\n";
$cabecalho_resposta = "MIME-Version: 1.0\r\n".
"Content-type: text/html; charset=ISO-8859-1\r\n".
"From: \"Missão AME\" <".$de.">\r\n";
$pedido = "<br />
<b> Nome: </b> ".$_POST['nome']." <br />
<b> E-mail: </b> ".$_POST['email']." <br />
<b> Data: </b> $date <br /><b> Ip: </b> $ip <br />
<b> Pedido de Oração: </b>". nl2br($_POST['mensagem']);
$pedido_resposta = "<br />
<b> Oi ! </b><br /> ".$_POST['nome'].", não se preocupe pois recebemos seu Pedido com sucesso!<br />
<b> Pedido: </b>". nl2br($_POST['mensagem'])."<br /><br />Atenciosamente: Missão AME";
mail($para,$assunto,$pedido,$cabecalho);
mail($email,$assunto_resposta,$pedido_resposta,$cabecalho_resposta);
echo "<script>window.location='../confirmacao.php'</script>";
} else
{
echo "<br /><span>Você esqueceu de digitar o código ou ele está incorreto.</span><br />";
}
echo "<br /><input type='submit' value='voltar' onclick='javascript:history.back();' />";
?>