mail() - local vs host remoto
Seguinte pessoal, estou fazendo um formulário de contato que me envia a mensagem formatada em HTML.. no meu servidor local funciona direitinho.. chega a mensagem certinho... mas quando mando para meu servidor remoto, a mensagem chega como códigos, acho que não está lendo os headers da mensagem... alguém tem uma idéia do que pode ser?? segue o código abaixo
<?php $nome = $_POST['nome']; $telefone = $_POST['telefone']; $endereco = $_POST['endereco']; $email = $_POST['email']; $mensagem = $_POST['mensagem']; $empresa = $_POST['empresa']; $erros = ""; // FUNÇÃO QUE VALIDA EMAIL function MailValidate($email) { return eregi('([A-Za-z0-9](([\w.-][^._-]{2,}){0,61})[A-Za-z0-9])'.'@'.'([A-Za-z0-9]([A-Za-z0-9-]{0,61})?[A-Za-z0-9]\.)+'.'([A-Za-z]{2,6})',$email); } if (MailValidate($email) == false) { $erros .= "O e-mail digitado é inválido.<br />"; } if ($erros == "") { /////////////////////////////////////////////////////// $assunto="Contato Website"; // DEFINE O CORPO DA MENSAGEM $mensagem = '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #a5b6d5; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } body,td,th { font-family: Tahoma; font-size: 11px; } table { height:200px; } .titulo { font-family:Arial; font-size: 14px; font-weight: bold; color: #FFFFFF; } --> </style> </head> <body> <br /><br /> <center><span class="titulo">Contato Website</span></center><br /><br /> <table width="340" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f3f3f4"> <tr> <td align="center" valign="top"> <table width="340" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20"> </td> <td width="300" align="left"> </td> <td width="20"> </td> </tr> <tr> <td width="20"> </td> <td width="300" align="left"> <b>Nome:</b><br />'.$nome.'<br /><br /> <b>Empresa:</b><br />'.$empresa.'<br /><br /> <b>Telefone:</b><br />'.$telefone.'<br /><br /> <b>Email:</b><br />'.$email.'<br /><br /> <b>Mensagem:</b><br />'.$mensagem.'<br /><br /> </td> <td width="20"> </td> </tr> <tr> <td width="20"> </td> <td width="300" align="left"> </td> <td width="20"> </td> </tr> </table></td> </tr> </table> </body> </html>'; // DEFINE OS HEADERS $add = "MIME-Version: 1.0\r\n". "Content-type: text/html; charset=iso-8859-1\r\n". "From: \"NOME DO SITE\" <admin@localhost>\n" . "Return-Path: $admin@localhost\n"; // AQUI COLOCA SÓ O EMAIL QUE VAI RECEBER O CONTATO if (mail("admin@localhost",$assunto,$mensagem,$add)) { // MENSAGEM QUE APARECE QUANDO DÁ CERTO echo "<p class=\"texto_contato\">Sua mensagem foi enviada com sucesso. <br /><b>Obrigado por entrar em contato conosco.</b></p>"; } else { // MENSAGEM QUE APARECE QUANDO DÁ ERRO echo "<p class=\"texto_contato\">Ocorreu um erro ao enviar a sua mensagem. Tente novamente mais tarde.</p>"; } } else { // MENSAGEM QUANDO ESQUECE ALGUMA VÁRIAVEL E TAL echo "<p class=\"texto_contato\"><b>Ocorreram os seguintes erros:</b><br /><br />"; echo $erros; echo "Clique <a href=\"java script:history.go(-1);\">Aqui</a> para voltar</p>"; } ?>Discussão (4)
Carregando comentários...