require_once "Mail/Queue.php"; // Create a mail queue object $mail_queue =& new Mail_Queue(); // Add a message to the queue $from = "from@example.com"; $to = "to@example.com"; $subject = "Test message"; $body = "Hello, this is a test message."; $message = new EmailMessage($from, $to, $subject, $body); $mail_queue->put($message); // Send the queued messages $mail_queue->sendMailsInQueue();This code creates a Mail Queue object, adds a test message to the queue, and then sends all queued messages in the background. The package library used here is the PEAR Mail_Queue.