Jump to content


Photo

mailing list help


  • Please log in to reply
1 reply to this topic

#1 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 March 2006 - 05:39 PM

guys,

how can i set my email form in such a way that my
$To =
will be getting the emails (meaning many) from the database?
i will be using it on my mailing list for sending newsletters.

hope you could help me with this.

thanks!



#2 kayess2004

kayess2004
  • Members
  • PipPip
  • Member
  • 18 posts
  • LocationAustralia

Posted 19 March 2006 - 05:49 AM

Hi,

I wouldn't recommend putting all you mailing list members in the "To:"
section. You should "Bcc:" them instead otherwise your whole list will
be visible to all of them.
You could try this:

$sql = "select name, email from mailing_list";
$result = mysql_query($sql);

$bcc = "Bcc: ";

while($row = mysql_fetch_array($result))
{
    $bcc .= $row['name']." ".$row['email'].",";
}
$to = "Me <myemail@myserver.com>";
$subject = // Whatever your subject
$body = // Whatever your body

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'You <youremail@yourserver.com>'. "\r\n";
$headers .= '$bcc' . "\r\n";

mail($to, $subject, $body, $headers);

HTH
Steve
Chuck Norris doesn't know love. Chuck Norris only knows not kill.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users