PHP Classes

PHP Mail Queue Class: Add mail messages to a queue to deliver them later

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 280 All time: 7,617 This week: 40Up
Version License PHP version Categories
phpeq 1.0.0GNU General Publi...5.0Email, PHP 5, Databases
Collaborate with this project 

Author

Description

This package can add mail messages to a queue to deliver them later.

There is one class that can compose the definition of a email message with all headers, text or HTML body and a category tag.

The queue class can take the compose messages and inserts them in MySQL database to which it connects using PDO.

The class can also retrieve all queue messages or only those that match a given category up to a given limit, so you can send them with separate script eventually the cron program using the mail function.

The class can also return the count of message pending in the queue.

After sending each message, the class can mark the message as sent so they are removed from the pending queue.

Picture of Ovunc Tukenmez
  Performance   Level  
Name: Ovunc Tukenmez <contact>
Classes: 14 packages by
Country: Turkey Turkey
Age: 38
All time rank: 72011 in Turkey Turkey
Week rank: 170 Up2 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php
require_once("PHPEQ/class/PHPEQ.php");

// instantiate the message queue
$queue = new PHPEQ();

// create a new PHPEQMessage object
$new_message = new PHPEQMessage();
$new_message->setFromEmail('from@email.com');
$new_message->setFromName('SENDER NAME');
$new_message->setToEmail('to@email.com');
$new_message->setToName('RECIPIENT NAME');
$new_message->setSubject('test subject');
$new_message->setMessageHtml('<b>TEST MESSAGE</b>');
$new_message->setMessagePlainText('TEST MESSAGE');
$new_message->setHeaders(array()); // optional
$new_message->setCategory('category 1'); // optional

// add message to queue
$queue->addMessage($new_message);


Details

PHP EMAIL QUEUE CLASS (PHPEQ) PHP Email Queue Class (PHPEQ) is a PHP class that is used to create and manage email queue using MYSQL database. Add emails to databased queue. Get emails from queue optionally filtered by category. It uses MYSQL database for storage. Easy to implement and all methods are commented. It decreases page load time by eliminating real time email sending. Instead of directly sending emails on the transactions, it is possible to insert email message to database using this class. Emails can be processed later by setting up a cron job. Example scripts are supplied. Public Methods of the Queue Class addMessage() getEmailCount() getEmails() getTableName() setConnectionDetails() setMessageIsSent() setTableName() All class methods are commented. Public Methods of the Message Class getCategory() getFromEmail() getFromName() getHeaders() getId() getIsSent() getMessageHtml() getMessagePlainText() getSerializedHeaders() getSubject() getTimestampCreated() getTimestampSent() getToEmail() getToName() setCategory() setFromEmail() setFromName() setHeaders() setId() setIsSent() setMessageHtml() setMessagePlainText() setSubject() setTimestampCreated() setTimestampSent() setToEmail() All class methods are commented. Documentation PHP Email Queue Class (PHPEQ) comes with full documentation. From the installation to the usage you will feel like home. Class Requirements PHP 5.2 and above MySQL 5.0 and above Folder Structure All the class files exist in code folder. To get more information about class installation process and usage help, open index.html file from "installation and documentation" folder. "installation and documentation" folder also contains a text file ("database.txt") that contains sql statements in order to create database table structure on your mysql server. Thanks for downloading this class! If you have improvement idea or bug fix, please feel free to contribute this class. Ovunc Tukenmez ovunct@live.com

Screenshots (3)  
  • preview.png
  • preview1.png
  • preview2.png
  Files folder image Files (49)  
File Role Description
Files folder imagecode (2 files, 1 directory)
Files folder imageinstallation-and-documentation (2 files, 1 directory)
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file readme.txt Doc. readme

  Files folder image Files (49)  /  code  
File Role Description
Files folder imagePHPEQ (1 directory)
  Accessible without login Plain text file cron_example.php Example Example script
  Accessible without login Plain text file example.php Example Example script

  Files folder image Files (49)  /  code  /  PHPEQ  
File Role Description
Files folder imageclass (3 files)

  Files folder image Files (49)  /  code  /  PHPEQ  /  class  
File Role Description
  Accessible without login Plain text file config-emailqueue.php Conf. Configuration script
  Plain text file PHPEQ.php Class Class source
  Plain text file PHPEQMessage.php Class Class source

  Files folder image Files (49)  /  installation-and-documentation  
File Role Description
Files folder imageassets (2 directories)
  Accessible without login Plain text file database.txt Data database tables
  Accessible without login HTML file index.html Doc. documentation

  Files folder image Files (49)  /  installation-and-documentation  /  assets  
File Role Description
Files folder imageblueprint-css (3 files, 2 directories)
Files folder imageimages (7 files)

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  
File Role Description
Files folder imageplugins (4 directories)
Files folder imagesrc (7 files)
  Accessible without login Plain text file ie.css Data v.1.0.0
  Accessible without login Plain text file print.css Data v.1.0.0
  Accessible without login Plain text file screen.css Data v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  plugins  
File Role Description
Files folder imagebuttons (2 files, 1 directory)
Files folder imagefancy-type (2 files)
Files folder imagelink-icons (2 files, 1 directory)
Files folder imagertl (2 files)

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  plugins  /  buttons  
File Role Description
Files folder imageicons (3 files)
  Accessible without login Plain text file readme.txt Doc. v.1.0.0
  Accessible without login Plain text file screen.css Data v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  plugins  /  buttons  /  icons  
File Role Description
  Accessible without login Image file cross.png Icon v.1.0.0
  Accessible without login Image file key.png Icon v.1.0.0
  Accessible without login Image file tick.png Icon v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  plugins  /  fancy-type  
File Role Description
  Accessible without login Plain text file readme.txt Doc. v.1.0.0
  Accessible without login Plain text file screen.css Data v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  plugins  /  rtl  
File Role Description
  Accessible without login Plain text file readme.txt Doc. v.1.0.0
  Accessible without login Plain text file screen.css Data v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  blueprint-css  /  src  
File Role Description
  Accessible without login Plain text file forms.css Data v.1.0.0
  Accessible without login Plain text file grid.css Data v.1.0.0
  Accessible without login Image file grid.png Icon v.1.0.0
  Accessible without login Plain text file ie.css Data v.1.0.0
  Accessible without login Plain text file print.css Data v.1.0.0
  Accessible without login Plain text file reset.css Data v.1.0.0
  Accessible without login Plain text file typography.css Data v.1.0.0

  Files folder image Files (49)  /  installation-and-documentation  /  assets  /  images  
File Role Description
  Accessible without login Image file p1.png Icon v.1.0.0
  Accessible without login Image file p17.png Icon v.1.0.0
  Accessible without login Image file p18.png Icon v.1.0.0
  Accessible without login Image file p2.png Icon v.1.0.0
  Accessible without login Image file p3.png Icon v.1.0.0
  Accessible without login Image file p4.png Icon v.1.0.0
  Accessible without login Image file p5.png Icon v.1.0.0

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 91%
Total:280
This week:0
All time:7,617
This week:40Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:66%StarStarStarStar
Examples:66%StarStarStarStar
Tests:-
Videos:-
Overall:53%StarStarStar
Rank:2239