Tech4World

Latest News in Social Media & Technology

  • Home
  • Twitter
  • Facebook
  • Android
  • iPhone
  • iPad
  • SEO
  • Design
  • Hosting
  • Blogging
You are here :Home Programming Php Script to Send Multiple Emails

Php Script to Send Multiple Emails

January 1, 2010 by Siddharth Leave a Comment

share

Looking for free mass mailing or bulk mailing php scripts to send multiple emails to your list at once?? This script will help you in that case. Additional recipient emails can be added to the first variable separating them by commas, not semicolons.

$to = “yourplace@somewhere.com,another@elsewhere.com“;

A more advanced method is to put a newline separated email list into a text file, trim each entry, implode them into an array variable and use the array variable as the $to value.

Steps to Send Multiple Emails:

Step 1: Create a “elist.txt”  file and continue as follows !

Mail List ( elist.txt )

firstemail@here.com
secondemail@there.com
yourplace@somewhere.com
another@elsewhere.com

Step 2: Create “test.php” file with contents below.

PHP email script ( test.php )

<!--?php <br ?--> // read the list of emails from the file.
$email_list = file(“elist.txt”);
// count how many emails there are.
$total_emails = count($email_list);
// go through the list and trim off the newline character.
for ($counter=0; $counter&lt;$total_emails; $counter++) {
$email_list[$counter] = trim($email_list[$counter]);
}
// implode the list into a single variable, put commas in, apply as $to value.
$to = implode(“,”,$email_list);
$subject = “My email test.”;
$message = “Hello, how are you?”;
if ( mail($to,$subject,$message) ) {
echo “The email has been sent!”;
} else {
echo “The email has failed!”;
}
?&gt;

Step 3: Upload to your server and run “test.php” file from your browser. It should work now.

Having a newline separated email list is much easier to manage and edit. An alternative would be to start off with a long comma separated list and get rid of the TRIM and IMPLODE command lines.

You may use it to send newsletters for your clients in matter of minutes. Note that, if you;re trying to email more than 200 at once, you might need to confirm with your host about the same. most web hosting providers don’t allow more than 200 per hour. you can get rid of it just by delaying a hour between successive list.

Important Note:

Be very sure you know what you are doing. This can be a powerful script. Bulk emailing may be considered as SPAM if you’re emailing to random list. You might even be charged a penalty for spamming the server by your host as your server IP will be marked spamming by the ISP of your web hosting provider!

No related posts.

Filed Under: Programming Tagged With: PHP, Php Script to Send bulk Emails, Php Script to Send Multiple Emails

About Siddharth

+Siddharth R is a full time Internet marketer from India. He assists his clients from designing a website to drive sales through SEO, PPC & Social Media.

National Do Not Call Registry – Check »

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badgeShow more posts

Subscribe to Tech4World RSSSubscribe to Tech4World FacebookFollow Tech4World on Twitter

Join Over 150,000+Fans & Followers

Recent Posts

  • 5 DIY Tech Projects to Keep You Busy During Covid-19
  • The Efficiency of Robotic application in Agriculture
  • Web Software is Still Indispensable
  • 10 Useful Technology Trends For 2018
  • 5 Udemy Courses to Sharpen Your Online Business Ethics
  • Why Windows Update Is Always an Issue and How to Fix It

Recent Comments

  • REKHA on 5 Misconceptions About PDF Files
  • Kuzey on How to Recover Data from Android Phone and Tablet
  • kuldeep singh on 5 Misconceptions About PDF Files
  • Cinematographer in jaipur on How can Spy Apps become both a Protector and Destroyer? The pros and cons of mobile spy apps
  • George Caputo on Top Most Irritating Windows 10 Issues And How To Fix Them
  • ANAND on 5 Misconceptions About PDF Files
  • Steve on How to Transfer WhatsApp Messages from iPhone to Android
  • Ashcraft on Bitdefender Mobile Security Review
  • ankush wadne on MacX DVD Ripper Pro -Speedy Alternative to Handbrake to Rip DVD at Fast Speed [Giveaway]
  • Richarlison on Top Most Irritating Windows 10 Issues And How To Fix Them

Other Catagories

  • General
  • Google
  • Mobile
  • Programming
  • Tablets

Pages

  • About Us
  • Contact Us
  • Guest Posts & Product Reviews
  • Internet Marketing Services

Email Updates

[footer_backtotop text="Return to Top" href="#"]

Copyright © 2022 - Tech4World | design by WPStuffs