Jump to content

Sending out newsletter to emails in database


downah

Recommended Posts

Hi, I am using the phpmailer class and a little script I found online, I have a form with a textarea called "plain" which submits and takes the action through to this page:

 

<?php

#include PHPMailer class and database connection
include("class.phpmailer.php");
include("connect.php");

#remove slashes from content
$plain = stripslashes($_POST["plain"]);

#initiate PHPMailer class
$mail = new PHPMailer();
#set the from e-mail address
$mail->From = "[email protected]";
#set the from name
$mail->FromName = "myname";

#the subject of the email
$mail->Subject = "Our Newsletter";
#the HTML content of the email
$mail->Body = $plain;


#loop through e-mail addresses
$query = "SELECT email FROM member";
$result = mysql_db_query ("define_pete", $query);
while ($myrow = mysql_fetch_array($result)){

#add subscribers address as the recipient
$mail->AddAddress($myrow["fldEmail"]);
#sends the newsletter
$mail->Send();
#clears the recipient address
$mail->ClearAddresses();


}

?>

 

It gives no errors and goes through, yet it definitely sends no emails out, I have made sure the emails are correct in the field email in the table member but it is, anyone got any clue what is going wrong?

 

Appreciated

Do you have the following directives in your php.ini file? If not, change them and restart Apache, then see if there are any errors returned.

 

error_reporting = -1 and display_errors = On

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.