rottenpixies Posted June 18, 2007 Share Posted June 18, 2007 Anyone know a smart way of mass emailing from a list that has a new email on every line. Does the server have to take a break between mail functions for it to work properly? Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/ Share on other sites More sharing options...
liam1412 Posted June 18, 2007 Share Posted June 18, 2007 Im not so sure what you mean. Can you not just send it through using a while loop to put all the email addys in the to: box of one e-mail. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276878 Share on other sites More sharing options...
akitchin Posted June 18, 2007 Share Posted June 18, 2007 this depends on how you want to send the e-mail. you can either send it as one e-mail with a comma-delimited list of recipients (akin to adding a whole bunch of people into one composition in Outlook or similar), or you can force it to loop through each recipient and send an individual e-mail. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276881 Share on other sites More sharing options...
per1os Posted June 18, 2007 Share Posted June 18, 2007 Anyone know a smart way of mass emailing from a list that has a new email on every line. Does the server have to take a break between mail functions for it to work properly? <?php $emails = file('email.txt'); foreach ($emails as $email) { mail($email, $sub, $message, $headers); } ?> That will work, but for a big list it is best to section it off or use a mailing que like PEAR::Mail or maybe phpMailer. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276886 Share on other sites More sharing options...
rottenpixies Posted June 18, 2007 Author Share Posted June 18, 2007 I'm looking to have it send an individual email to each person so it looks like the mail was sent just to them. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276894 Share on other sites More sharing options...
liam1412 Posted June 18, 2007 Share Posted June 18, 2007 Okay all you need to do is loop through the details using a while loop and a create a mail function for each one then Assuming your taking the data from the database select the e-mail address using this $get_addy = mysql_query("SELECT email FROM users") while($array = mysql_fetch_array($get_addy)){ create your mail function here } This will loop through your database until there is no users left. Im no exchange expert but im sure it would just que them up if php was running faster than the mailer could send. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276901 Share on other sites More sharing options...
rottenpixies Posted June 18, 2007 Author Share Posted June 18, 2007 I'm not pulling the emails out of a DB just a txt file with a new email for each line. Couldn't run your script for some reason frost, thanks in advances for posts! Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276915 Share on other sites More sharing options...
liam1412 Posted June 18, 2007 Share Posted June 18, 2007 You can still use the same principle but collecting from a text file instead. Did you get any errors Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276927 Share on other sites More sharing options...
GingerRobot Posted June 18, 2007 Share Posted June 18, 2007 How is your text file laid out? Is it simply an email or each line or is there other information? And what did you mean by you couldn't run the script? Did you get any errors? Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276940 Share on other sites More sharing options...
rottenpixies Posted June 18, 2007 Author Share Posted June 18, 2007 This is what I am attempting: $file = fopen($entry, 'r'); while (!feof($file)) { $line = fgets($file); $sub = "www.leadmasterz.com"; $message = "Come visit www.leadmasterz.com."; $headers = "From: info@leadmasterz.com"; mail($line, $sub, $message, $headers); ; } fclose($file); I get the following error: Warning: mail(): Bad parameters to mail() function, mail not sent. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276945 Share on other sites More sharing options...
rottenpixies Posted June 18, 2007 Author Share Posted June 18, 2007 Yes the email file just contains a single email on each line with no other information... blahblah@yahoo.com testtest@aol.com rottenpixies@email.com Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276946 Share on other sites More sharing options...
liam1412 Posted June 18, 2007 Share Posted June 18, 2007 Ginger - I've not really dealt with file handling yet apart from to upload so you may be better on this one. Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-276952 Share on other sites More sharing options...
rottenpixies Posted June 18, 2007 Author Share Posted June 18, 2007 I removed the extra semi-colon and that didn't fix the problem I still get the following error: Warning: mail(): Bad parameters to mail() function, mail not sent. It seems to be sending it to the first email in the list but not to the next few, do I need to have some kind of a timeout of pause function in between each mail send? Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-277090 Share on other sites More sharing options...
gtk Posted June 19, 2007 Share Posted June 19, 2007 Anyone know a smart way of mass emailing from a list that has a new email on every line. Does the server have to take a break between mail functions for it to work properly? <?php $emails = file('email.txt'); foreach ($emails as $email) { mail($email, $sub, $message, $headers); } ?> That will work, but for a big list it is best to section it off or use a mailing que like PEAR::Mail or maybe phpMailer. You Guys have the Author of Zigmoyd Mailer as a regular Member of your Forum. Why do you forward To teh Worst PHP Mailer.Zigmoyd Mailer is fast Cool and Too easy. Its Group_mail Class is Too easy to use. It comes with very good Support. Hi! I am Neel Basu. Something about Me Is Given Bellow. I would like to be your friend. You Can add My msn email address to Your Friend listWhere as PHPmailer needs a Huge Memory (That much memory is really Huge if compared with teh group_mail Class) Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-277391 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 you can't just say that you need to explode the flat file apart at the break lines general \n of UTF-8 I think Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-277392 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 also your idea is a privacy no no you need to set each additional user as a BCC not a recipent to mask all email adderssses Quote Link to comment https://forums.phpfreaks.com/topic/56061-email-a-list/#findComment-277394 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.