Forum Moderators: mack
what i want to do is fetch the results of the email column and add the results into an email box's "to" section so that i can then write out a short email message to all in the database.
having problems finding any help on this.
any ideas?
add the results into an email box's "to"
This is an EXTREMELY bad idea.
When you put the following in the To or CC field
address1@example.com, address2@example.com, address3@example.com
All three of the above recipients can see the other two email addresses. Same with CC. This is one of the ways spam makes it's way around the Internet. Those emails that offer some warning about pop-rock candy meth, or warn of a virus? The one where someone wakes up in a hotel room with a kidney missing? They always say "forward to everyone you know" for this exact reason - as it gets forwarded around, it eventually winds up in the hands of a spammer, thank you very much for all the email addresses.
This is so common I've even seen one of our wholesale distributors do it, giving us the email addresses of all our competitors! (And they gave THEM ours, I was so pi**ed!).
If you must use a traditional mailing method to send out to a list, be absolutely sure you put the list in the BCC field. But this is most likely not the most efficient way to do this.
You are best off writing some perl, PHP, or ASP script (that includes a secure login scheme some someone can't get in and spam your customers) that loops through your database and does something like this:
$mymessage = 'Some message content';
$myfrom = 'noreply@example.com'; # see above why you want this
$mysubject = 'Hello from example.com';
$select = "select fname,lname,email from database_table";
Then in your while loop:
while ($fname,$lname,$email) {
$thismessage = "Dear $fname $lname, <br> $mymessage";
&mail($email,$myfrom,$mysubject,$thismessage);
}
The mail subroutine would send out individual personalized emails using your host's mail program, which you can probably modify from any PHP, perl, or ASP mailer.
The last bit of advice, you'd better be sure all of these recipients opted in to your list and are expecting communications from you, spamming will get your hosting account shut down chop-chop. :-)
Look into some e-newsletter suites. There are some good ones that will even read from your database. They do great things like managing the bounces which will let you assign scores for certain things like bounces and if someone's score gets to high it drops them from the list so you aren't wasting server power. They also have built in automatic subscribe/unsubscribe functionality which is required by law most places.
Unless you are planning on spending a lot of time making your code full featured like this then there is no reason to not use something off the shelf already.