downah Posted March 5, 2012 Share Posted March 5, 2012 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@email.com"; #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 Quote Link to comment https://forums.phpfreaks.com/topic/258326-sending-out-newsletter-to-emails-in-database/ Share on other sites More sharing options...
Pikachu2000 Posted March 5, 2012 Share Posted March 5, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/258326-sending-out-newsletter-to-emails-in-database/#findComment-1324227 Share on other sites More sharing options...
xyph Posted March 5, 2012 Share Posted March 5, 2012 Also, are you sure you've configured phpmailer correctly? Is a tested, working mail server being used? In other words, are you sure you've isolated the problem to PHP? Quote Link to comment https://forums.phpfreaks.com/topic/258326-sending-out-newsletter-to-emails-in-database/#findComment-1324232 Share on other sites More sharing options...
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.