Jump to content

Sending out newsletter to emails in database


downah
 Share

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@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

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

 Share

×
×
  • 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.