- This topic is empty.
January 26, 2014 at 9:38 am #161145mister_techParticipant
I want to send email to selected email addresses that are in mysql database from php..The below code will send to all, but I can’t quite figure out how to setup a form to select email addresses to send to:
From = ‘[email protected]’;
$mailer->FromName = ‘Georgia Sting Admin’;
$mailer->Body = ‘TEST EMAIL’;
$mailer->Subject = ‘This is the subject of the email’;
$query_rs30dayevents = “SELECT pro.email, pro.check FROM pro WHERE pro.
$rs30dayevents = mysql_query($query_rs30dayevents, $MySQL) or die(mysql_error());
$row_rs30dayevents = mysql_fetch_assoc($rs30dayevents);
$totalRows_rs30dayevents = mysql_num_rows($rs30dayevents);
// get email addresses from db base
while( $data = mysql_fetch_assoc($rs30dayevents))
// make SURE we are not sending this to each and every recipient incrementally.
// alternately, you can use $mailer->ClearAllRecipients(); ClearAddresses();
// send it to THIS user…
print ($mailer->Send()) ? "Message sent to: " : "Message not sent to: "; print $data["email"]." \n";
Can anyone help…January 26, 2014 at 10:51 am #161148__Participant
This is the sql that determines which email addresses are retrieved:
SELECT pro.email, pro.check FROM pro WHERE pro.check=1
…in other words, if the
pro.checkcolumn holds the value
1, it will be selected. If you want to select emails by some other criteria, you’ll need to figure out what that criteria is, and then we can figure out how to filter it.
If you’re talking about selecting specific email addresses (manually), then you’d need to select all of them beforehand and load them into a
<select>field so you can choose them when you fill out the form.
- The forum ‘Back End’ is closed to new topics and replies.