PHP Classes

File: code/cron_example.php

Recommend this page to a friend!
  Classes of Ovunc Tukenmez   PHP Mail Queue Class   code/cron_example.php   Download  
File: code/cron_example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Mail Queue Class
Add mail messages to a queue to deliver them later
Author: By
Last change: v.1.0.0
Date: 8 years ago
Size: 463 bytes
 

Contents

Class file image Download
<?php
require_once("PHPEQ/class/PHPEQ.php");

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

// get messages from the queue
$messages = $queue->getEmails();

// iterate messages
foreach ($messages as $message){
   
// send email
   
mail($message->getToEmail()
        ,
$message->getSubject()
        ,
$message->getMessagePlainText()
        );
   
   
// remove message from the queue by updating is_sent value
   
$queue->setMessageIsSent($message);
}