|
Posted by J.O. Aho on 02/12/07 11:58
trashed wrote:
> Rik wrote:
Please don't top-post and use a news-client that can quote properly too.
>> $result = mysql_query('SELECT `mail` FROM `table` WHERE `mailinglist` =
>> \'yes\'') or die(mysql_error());
>> while($row = mysql_fetch_assoc($result){
>> mail($row['mail'],'This is the title','And here is the text body');
>> }
>>
>> Or possibly:
>>
>> $mails = array();
>> while($row = mysql_fetch_assoc($result) $mails[] = $row['mail'];
>> mail('you_own_emailadress@example.com','Title','Text','Bcc:
>> '.implode(',',$mails));
> Is it possible you can post more of that code so I can see how I can
> integrate my mail script with it? Would you mind??
> I'm not sure how you can but I'm unclear where/how to put it all together.
All you need is to add the connecting to the database code which you should
have already experience of.
> What is the difference? Why would there be two possibilities?
The first one sends a mail to each one of the user, this will be okey for
small lists of users, as your script will time out after a while, you can add
some output each time a mail has been sent (see to disable buffering).
The second one does use send a carbon copy each user, this works for a mid
range list of users, most mail servers have a limit on how many you can have
in a Cc: or Bcc:, but this goes quite fast as you have only one mail sent
(seen from the PHP scripts point of view).
The best is really make a thing in between, that groups users into groups of
~20 and Bcc: to those and then next group and so on.
Keep in mind that your mail can be thought as spam, so create a proper mail
header, don't try to copy what your mail client creates, as this will more
likely heighten the risk for your mail to be caught by spamfilters.
Do read http://www.php.net/manual/en/function.mail.php
--
//Aho
Navigation:
[Reply to this message]
|