How to Send a Mass PHP Email

How to Send a Mass PHP Email thumbnail
PHP can make sending mass emails easier

There are a number of different reasons you might need to send an email to a large number of people. Perhaps you run a small business or a club and need to send newsletters, special event notices or invitations to your customers or members.



With Microsoft Outlook and online email services such as Gmail, your ability to send mass emails is limited. Many versions of Outlook limit emails to approximately 100 recipients, and Google will temporarily disable your account if you send messages to more than 500 recipients per day.



Instead, you can use the popular computer scripting language PHP to accomplish your goals. Select one of the open source PHP code libraries that are freely available. The most widely used code libraries are phpList, PHPMailer and SwiftMailer.

Things You'll Need

  • Web hosting account
  • FTP or other upload access to web server
Show More

Instructions

  1. phpList

    • 1

      Make sure you have access to your website's hosting account. You must also verify that PHP is installed and available on the server on which your account is running.

    • 2

      Download the latest stable release from the phpList website and unpack the directories and files from the archive. Upload the directories and files to a directory on your web server that is accessible via the web, and create a database for phpList to use. Use a web browser to navigate to the "lists/admin" sub-directory where you uploaded the files to complete the installation.

    • 3

      For phpList, log in to the admin section and create a list of the individual email addresses to which you want to send your message. Click the "Send a message" menu item and prepare the actual email. When you are satisfied with the message, click the "Send" button.

    PHPMailer

    • 4

      Make sure you have access to your website's hosting account. You must also verify that PHP is installed and available on the server on which your account is running.

    • 5

      Download the PHPMailer package from the PHPMailer website and extract the "class.phpmailer.php" and "languages/phpmailer.lang-en.php" files. Upload these files to the working directory on your web server. Note that PHPMailer does not have a graphical user interface, so you'll need to call the class directly in another PHP script.

    • 6

      Draft a PHP script that includes the class.phpmailer.php file ("require("class.phpmailer.php");"), then create a new object from the PHPMailer() class ("$mail = new PHPMailer();"). Use "$mail->From", "$mail->AddAddress" and "$mail->Body" to prepare the message within the script. Use "$return = $mail->Send()" at the end of the script to send the message.

    SwiftMailer

    • 7

      Make sure you have access to your website's hosting account. You must also verify that PHP is installed and available on the server on which your account is running.

    • 8

      Download the most recent package of SwiftMailer from the SwiftMailer website, and extract the files. Upload all of the files from the "lib/" directory to your web host. Again, note that SwiftMailer is a class that you call in another PHP script in order to send mass emails.

    • 9

      Write a new PHP script that includes the swift_required.php file ("require_once 'lib/swift_required.php';"), and calls the newInstance() method of Swift_Message ("$message = Swift_Message::newInstance()"). Use the "setFrom()", "setTo()" and "setBody()" methods to prepare the message itself. To send the message create a transport, create an instance of Swift_Mailer using the transport you created and use the send() or batchSend() methods on that object.

Tips & Warnings

  • Avoid using only the default mail() function that's built into PHP. Although you could write your own PHP mass email application from scratch by using the mail() function, that function can be a significant drain on your computing resources because it opens and closes an SMTP connection for each email. In addition, it can be difficult to properly throttle the pace at which your emails are sent, which increases the likelihood that the receiving mail server will flag your message as spam.

  • Be sure that every recipient to each of your mass emails has agreed to be on your mailing list, and promptly remove anyone who requests to no longer receive your correspondence.

Related Searches:

References

Resources

  • Photo Credit global technology image by patrimonio designs from Fotolia.com

Comments

You May Also Like

  • How to Send Mass Mail With PHP

    User-driven websites are often created using the PHP scripting language. Emailing each user one at a time can be quite time consuming,...

  • How to Send Bulk Email

    You can send a single email, forward, or attachment to multiple recipients at one time by using the bulk email function in...

  • How to Send an SMS with a PHP Script

    With nearly everyone carrying a cellular phone, Short Message Service (SMS) is a powerful way to reach people wherever they are. Your...

  • About Email Attachments Using PHP

    A Web programmer can design a Web page that allows visitors to send emails with attachments. He can use PHP and HTML...

  • How to Send PHP Mail to HTML Email

    PHP provides Web developers with website creation tools. PHP is a server-side language, so the code created runs on the server and...

  • How to Send Mass Email on Facebook

    Facebook is being used by professionals, organizations and online business owners more and more. Sending mass e-mails is easier and faster than...

  • How to Send a Free SMS Using PHP

    Short message service (SMS) messages, also known as text messages, have become the preferred way of communication for many people. They offer...

  • How to Send a SMS Using PHP Script

    SMS stands for "short messaging service" and it is the basis for text messaging on cell phones. Traditionally, these messages could be...

  • How to Send a Mass Email on MySpace

    Using the MySpace Bulletin function is an efficient way of delivering information to all of your friends simultaneously. This is a great...

  • How to Send Email Attachments in PHP

    Sending emails from a web page is a fairly common task, and often sending an attached file is required---perhaps you're sending a...

  • How to Send HTML Email via PHP Mail

    Email has become an ubiquitous form of communication that anyone can use. Programmers also use email to provide information to their users...

  • How to Create a Mass Email

    Sending the same email message to multiple people can get tedious to say the least if you are sending the email to...

  • What Is Daemon Mailer?

    Daemon Mailer is a program used by email programs to handle incoming email, according to Lycos. When something goes wrong with an...

  • How to Create Plain Text & Mime Formatted Email With PHP

    When sending emails, there are two different formats used: plain text and MIME format. MIME is short for Multipurpose Internet Mail Extensions....

  • How to Use PHP Mailer

    Receiving bulk emails can be an annoyance, but they are very important to businesses and non-profit organizations seeking to solicit customers and...

  • What Is a PHP File?

    A PHP file is a text document containing a specific code that is ran and executed by a program called an interpreter....

  • How to Set Up a PHP Mailer

    Mailing lists are an effective means to spreading your message, be that message a personal communication to scattered family, or a commercial...

  • How to Send Bulk Emails Through SMTP

    To regulate abusive activity, many ISPs (Internet service providers) no longer allow their Internet users to relay bulk email using third-party email...

Related Ads

Featured