Jump to content

[SOLVED] Best way to grab email addresses from MySQL and send an email....


suttercain

Recommended Posts

Hi everyone,

 

I am making a simple mail form that will SELECT email address from a MySQL table based on the userid of the person sending the email.

 

if (isset($_POST['submit'])) {
require('../database.php');
$result = mysql_query("SELECT * FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error());

 

What would be the most efficient way of storing the email addresses from MySQL (may be 1 or may be 100) and then sending them in BCC to all the people gathered from the MySQL table?

 

Thanks

 

SC

Link to comment
Share on other sites

Alright, I tried:

[code]
<?php

if (isset($_POST['submit'])) {
require('../database.php');
$result = mysql_query("SELECT emailAlerts FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error());
$row = mysql_fetch_array($result);
$bcc = implode(", ", $row);
echo $bcc;
}

?>

 

But it echoes the same email address twice instead of each separate address. Any suggestions?

 

Thanks[/code]

Link to comment
Share on other sites

  • 7 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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