Tech4World

Latest News in Social Media & Technology

  • Home
  • Mobile
  • Hosting
  • Contact Us
You are here :Home Programming Php Script to Send Multiple Emails

Php Script to Send Multiple Emails

February 6, 2013 by Siddharth Leave a Comment

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 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 *

Subscribe to Tech4World RSSSubscribe to Tech4World FacebookFollow Tech4World on Twitter

Join Over 150,000+Fans & Followers

Recent Posts

  • How to Choose the Best VPS Hosting Provider
  • Understanding Cloud Computing: A Beginner’s Guide
  • How is the Cloud Different from the Internet
  • 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

Recent Comments

  • Ready Mailing Team on 5 DIY Tech Projects to Keep You Busy During Covid-19
  • Harriet J. Hartley on How is the Cloud Different from the Internet
  • Yogesh Shinde on How to Choose the Best VPS Hosting Provider
  • Raphael on How to Choose the Best VPS Hosting Provider
  • kidsbrooklyn on How to Choose the Best VPS Hosting Provider
  • shubham on How to Choose the Best VPS Hosting Provider
  • Digital Campus on How to Choose the Best VPS Hosting Provider
  • Sandiv on How to Choose the Best VPS Hosting Provider
  • CodeSquadz on Understanding Cloud Computing: A Beginner’s Guide
  • anjali on Understanding Cloud Computing: A Beginner’s Guide

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 © 2025 - Tech4World | design by WPStuffs