Jump to content

Archived

This topic is now archived and is closed to further replies.

pixeltrace

mailing list help

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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:

[code]
$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);
[/code]

HTH
Steve

Share this post


Link to post
Share on other sites

×

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.