Jump to content
Fórum Script Brasil
  • 0

Erro envio (funçao mail)


Marcos Geam

Question

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

  • 0

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 by Jefferson Oliveira
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...