Problema ao Enviar Email
Boa Tarde..
É o seguinte galera...
Tenho um script q envia emails para uma lista de clientes meu, o problema é o seguinte, eu escolho a imagem e ele envia, mas quando insiro algum texto, no hotmail ele abra a imagem e texto normal, no ig, gmail, outlook ele abre apenas a imagem, o texto nao aparece, o que será q esta acontecendo????
<?
session_start("admin");
$_SESSION["n"] = $n;
$_SESSION["remetente"] = $remetente;
$_SESSION["assunto"] = $assunto;
$_SESSION["imagem"] = $imagem;
if($_SESSION["admin"] == "on")
{
require('../../admin/permissao.php');
$conexao=@mysql_connect($servidor,$usuario,$senha) or exit ('erro de conexao');
@mysql_select_db($base_dados,$conexao) or exit ('erro na conexão com o Banco');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Grife Web - Sites Corporativos, Portais, Sistemas, E-commerce, Email Marketing</title>
<link href="../../estilo.css" rel="stylesheet" type="text/css">
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="143" align="center" background="../../imagens/back.png">
<table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<img src="../../imagens/topo_sis.png" alt="" width="900" height="149" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="8,5,178,155" href="../index.php" alt="Página Inicial" />
</map>
</td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" height="233" border="0" cellpadding="1" cellspacing="1">
<tr>
<td height="30" align="center" valign="middle" bgcolor="#333333" class="topo">Envio de Newsletter</td>
</tr>
<tr>
<td height="148" align="center" valign="middle" class="texto_bottom"><label>
<?
// DADOS DE ACESSO AO BANCO MYSQL
require('config.php');
$n = $_SESSION["n"];
$remetente = $_SESSION["remetente"];
// NOME DA TABELA
$tabela = "newsletter";
// CAMPOS UTILIZADOS PARA A CONSULTA
$campos = "id, email";
// NUMERO MÁXIMO DE ENVIO
$quant = 1;
// TEMPO ENTRE UM PROCESSO DE ENVIO E OUTRO
$seg = 4;
$imagem = $_SESSION["imagem"];
$titulo_news = $_POST['titulo_news'];
$mensagem = nl2br($_POST['mensagem']);
$msg = "
<html>".
$titulo_news."
<img src='http://www.grifeweb.com/sis/newsletter/$imagem'>".
$mensagem."
</html>";
// DADOS DO EMAIL A SER ENVIADO
$assunto = $_SESSION["assunto"];
// CONECTA COM O SERVIDOR MYSQL
mysql_connect($host,$usuario,$senha);
// SELECIONA O BANCO
mysql_select_db($banco);
// RESGATA O VALOR DA GLOBAL INICIO
$inicio = $_GET["inicio"];
// VERIFICA SE FOI ATRIBUIDO VALOR A VARIAVEL "INICIO"
if($inicio == "")
{
// ATRIBUI O VALOR 0 CASO NÃO EXISTA VALOR ATRIBUIDO
$inicio = 0;
}else
{
// ATRIBUI O VALOR DA GLOBAL INICIO CASO JA EXISTA VALOR ATRIBUIDO
$inicio = $_GET["inicio"];
}
// ATRIBUI O RESULTADO DA SOMA ENTRE INICIO E QUANT
$fim = $inicio + $quant;
// EXECUTA A CONSULTA OU INFORMA UM ERRO CASO OCORRA
$sql = mysql_query("SELECT ". $campos ." FROM ". $tabela ." WHERE enviado = 0 LIMIT ". $inicio .",". $quant)or die(mysql_error());
// VERIFICA SE AINDA EXISTEM EMAILS A SEREM ENVIADOS
if(mysql_num_rows($sql) == 0)
{
// INFORMO O TÉRMINO DO PROCESSO
echo "<span class='style1'>Fim do processo de envio!</span>";
$consulta= "SELECT * FROM newsletter ORDER BY id asc ";
$retorno = mysql_query($consulta,$conexao);
while($campos = mysql_fetch_assoc($retorno))
{
$id_ant = $campos['id'];
$consulta2 = "UPDATE newsletter SET enviado ='0' WHERE id='$id_ant'";
mysql_select_db($base_dados, $conexao);
$Result1 = mysql_query($consulta2, $conexao) or die(mysql_error());
print "".$campos['email']." realocado com sucesso ";
print "<br>";
}
}else
{
// CONTINUA EFETUANDO O ENVIO
echo "<meta http-equiv='refresh' content='$seg,URL=?inicio= $fim'>";
}
// CRIA O LAÇO REPETITIVO
while($r = mysql_fetch_assoc($sql))
{
// ADICIONAMOS OS PADRÕES DE DESTINATÁRIO
$para = $r['email'];
$id = $r['id'];
$cabecalho = "MIME-Version: MSHTML 6.00.2900.3157\r\n";
$cabecalho = "Content-type: text/html; charset=iso-8859-1\r\n";
$cabecalho .= "Content-Type: text/html; charset=windows-1252\r\n";
$cabecalho .= "From:$remetente<$n>\r\n";
$cabecalho .= "Reply-to:<$remetente>\r\n";
// ENVIA O EMAIL PARA O DESTINATÁRIO
if(mail("$para", "$assunto", "$msg", "$cabecalho"))
{
// INFORMA SE A MENSAGEM FOI ENVIADA
echo "<span class='style1'>Mensagem enviada para: $para ($id)</span>";
// ALTERO O CODSTATUS PARA 1
@mysql_query("UPDATE newsletter SET enviado = '1' WHERE email = '$para'");
}
else
{
// INFORMO SE A MENSAGEM NÃO FOI ENVIADA
echo "<span class='style1'>Mensagem não enviada para: $para ($id)</span>";
}
}
// LIBERA MEMORIA USADA NA CONSULTA
mysql_free_result($sql);
}
?></label></td>
</tr>
<tr>
<td height="51" align="center" valign="middle" class="texto_bottom"><img src="../../imagens/ferramentas_sis.png" width="20" height="20" /> <a href="../index.php" class="texto_bottom">Voltar para Sistema</a></td>
</tr>
</table>
</body>
</html>Discussão (2)
Carregando comentários...