Marcos Geam Posted September 26, 2011 Report Share Posted September 26, 2011 Pessoal qual o erro na função abaixo, tentando enviar uma newsletter para emails cadastros no banco;mysql_select_db($database_conn, $conn);$query_n_emails = "SELECT email_assinante FROM ntb_emails";$n_emails = mysql_query($query_n_emails, $conn) or die(mysql_error());$row_n_emails = mysql_fetch_assoc($n_emails);$totalRows_n_emails = mysql_num_rows($n_emails);?><?php$to = $$totalRows_n_emails;$subject = "Newsletter";$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";$html = '<!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">...';if (mail($to, $subject, $html, $headers)) { echo "Email enviado com sucesso !";} else { echo "Ocorreu um erro durante o envio do email.";} Quote Link to comment Share on other sites More sharing options...
0 Jefferson Oliveira Posted September 26, 2011 Report Share Posted September 26, 2011 (edited) Poe Esses Headers aqui!// To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: Jefferson Oliveira' . "\r\n"; $headers .= 'From: Nome do site <no-reply@mamboo.com.br>' . "\r\n"; No seu está faltando o From: To: e algumas outras tipo... Caso não envi de qualquer forma, você tem que verificar no servidor com o <?php phpinfo(); ?> Edited September 26, 2011 by Jefferson Oliveira Quote Link to comment Share on other sites More sharing options...
0 Marcos Geam Posted September 26, 2011 Author Report Share Posted September 26, 2011 continua sem enviar;pensei o erro tivesse na variavel atribuida a $TO como se ele não reconhecesse o valor, pois a funcao mail funciona só não envia os emails; Quote Link to comment Share on other sites More sharing options...
Question
Marcos Geam
Pessoal qual o erro na função abaixo, tentando enviar uma newsletter para emails cadastros no banco;
mysql_select_db($database_conn, $conn);
$query_n_emails = "SELECT email_assinante FROM ntb_emails";
$n_emails = mysql_query($query_n_emails, $conn) or die(mysql_error());
$row_n_emails = mysql_fetch_assoc($n_emails);
$totalRows_n_emails = mysql_num_rows($n_emails);
?>
<?php
$to = $$totalRows_n_emails;
$subject = "Newsletter";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$html = '
<!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">...';
if (mail($to, $subject, $html, $headers)) {
echo "Email enviado com sucesso !";
} else {
echo "Ocorreu um erro durante o envio do email.";
}
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.