Jump to content

Send e-mail to some or all email addresses that are in a table


steviemac

Recommended Posts

I am still very new to php but I have been slowly learning.

 

I have a DB table that contains the individual e-mail addresses.  I want to be able to send an email to some or all of the individuals on the table. Right now it will only send to one individual at a time.

I have made an e-mail form using check boxes to select the e-mail address.

 

<form  method="post" name="bulkemail" action="bulkemail.php">
  <table border="0" cellspacing="1" cellpadding="2" bgcolor="#CCCCCC" width="80%">
  
    <tr> 
      <td class="thetag" bgcolor="#DDDDDD">Contact_Person</td>
      <td class="thetag" bgcolor="#DDDDDD">email_address</td>
    </tr>
    <?
  $cnt = $from;
  while ( $row = mysql_fetch_array($result) ) {
?>
    <tr> 
      <td class="thevalue" bgcolor="#FFFFFF"><? echo $row['Contact_Person']; ?></td>
      <td class="thevalue" bgcolor="#FFFFFF"><input name="email" type="checkbox" value="<? echo $row['email_address']; ?>"><? echo $row['email_address']; ?>[/color]</td>
  </tr>
  </td></tr>
    <?
   $cnt++;
  }
?>
  </table>
  <P>Subject<input name="subject" type="text" size="50"></p>
  <P>Comments<br>
  <textarea name="comments" cols="80" rows="15"></textarea>
  <br><br><input name="submit" type="submit" value="submit"></p>
  </form>

 

I think my problem is the line that echos email_address for the check box.  Each user has an individual id.  I can make the check box echo there id.  I'm not sure how to make id=email address.

 

This is the submit code.  I have only added where I think my problem is.

$emailSubject = FilterCChars("$FTGsubject");

$emailBody = "$FTGcomments\n"
. "\n"
. "";
$emailTo = "<$FTGemail>";
  
$emailFrom = FilterCChars("[email protected]");
  
$emailHeader = "From: $emailFrom\n"
  . "MIME-Version: 1.0\n"
  . "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
  . "Content-transfer-encoding: 8bit\n";
  
mail($emailTo, $emailSubject, $emailBody, $emailHeader);

 

I believe that the $emailTo is my problem.  I believe I have to somehow make id=email to make everything work so it will send to multiple e-mail addresses.

 

I will appreciate any help.

Thank You

$emailBody = "$FTGcomments\n"
. "\n"
. "";
$emailTo = "<$FTGemail>";

 

 

$emailBody = "$FTGcomments\n"
. "\n"
. "";
$emailTo = $FTGemail;

 

Your code looks a little confused. But I think you had PHP code inside a PHP code block like this:

 

<?php

 

<?

 

?>

 

which is wrong.

 

monk.e.boy

Sorry to be slow.  I'm not explaining myself very well.  I have made a check box for the <? echo $row['email_address']; ?> I want to be able to check multiple email addresses and have them inputed into bulkemail.php code. 

 

In the send to it has the $emailTo = "<$FTGemail>"; It will send to one but not to multiple addresses.  I believe my problem is that when the table is echoed from the database all the email addresses = email

I think I need to make the bulkemail.php code see there individual id and the email address associated with it to make it work. 

 

That is what I'm not sure how to do.

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.