dare87 Posted May 10, 2008 Share Posted May 10, 2008 I have been searching google all morning for a mailing list that will impement within my current user db and I have given up. Right now I have a bit a code that send a message to all my users when post a news announcement. I have run into the problem that 1. it shows everyone, everyone else email address. and 2. I now have to many users and the process times out. this is what I have, if you now of something that will help please let me know. require_once('../../pimysql_connect.php'); $query = "select email from users where access_level <=2 and email IS NOT NULL"; $results = @mysql_query ($query); $entry = ''; while ($categoryrow = mysql_fetch_array ($results, MYSQL_NUM)) { if ($entry) $entry = $entry.', '; $entry = $entry.$categoryrow[0]; } Here is my header and body crap $headers = "From: BLAH < [email protected] >\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $body = "This is an automated message do not reply to this message.\n\n"; $body .= "News has been posted on the website\n"; $body .= "Please go read it\n\n"; $body .= "Regards,\n"; $body .= "The Website \n"; $body .= "http://www.BLAH.com/login.php\n\n"; $body .= "If you get this email by error please contact us at http://www.BLAH.com/contact.php"; mail ($entry, "$title - Update", $body, $headers); Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/ Share on other sites More sharing options...
DarkWater Posted May 10, 2008 Share Posted May 10, 2008 Show us the uhh...database schema. Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/#findComment-537843 Share on other sites More sharing options...
AndyB Posted May 11, 2008 Share Posted May 11, 2008 Show us the uhh...database schema. I have no idea how that's relevant. The way to avoid all addresses being seen is to set them as a bcc field. Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/#findComment-538006 Share on other sites More sharing options...
DarkWater Posted May 11, 2008 Share Posted May 11, 2008 Show us the uhh...database schema. I have no idea how that's relevant. The way to avoid all addresses being seen is to set them as a bcc field. He said: 1. it shows everyone, everyone else email address. Therefore, it's not selecting the right e-mails. He only wants access_level <= 2. =/ Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/#findComment-538014 Share on other sites More sharing options...
dare87 Posted May 11, 2008 Author Share Posted May 11, 2008 I also don't see why you need the database structure. I have users, they have email address.. that’s all that matters. I don’t want to have to add them to another db and I don’t want them to verify, because they already have. just to clarify. The code posted above works but now that i have 100+ users it times out because it takes too long to send the email. So is there a way to set it to send x amount at a time until it has sent it to all? Or something like that? Also the email shows the "to" as [email protected], [email protected], ...etc I now that bcc is a blind copy, but how do you set that in a header? Thanks, if you need more clarifying let me know. Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/#findComment-538088 Share on other sites More sharing options...
dare87 Posted May 11, 2008 Author Share Posted May 11, 2008 I got the bcc figured out but still need to make it so it doesn't time out. $headers = "From: BLAH < [email protected] >\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $headers .= "Content-type:text/html; charset=iso-8859-1\r\n"; $headers .= "BCC: ".$entry."\r\n"; $body = "This is an automated message do not reply to this message.\n\n"; $body .= "News has been posted on the website\n"; $body .= "Please go read it\n\n"; $body .= "Regards,\n"; $body .= "The Website \n"; $body .= "http://www.BLAH.com/login.php\n\n"; $body .= "If you get this email by error please contact us at http://www.BLAH.com/contact.php"; mail ('[email protected]', "$title - Update", $body, $headers); Link to comment https://forums.phpfreaks.com/topic/105066-solved-mailer/#findComment-538127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.