pMailAdmin
QmailAdmin written in PHP, for those who want to control Qmail+vpopmail directly from PHP.

Home
  pMailAdmin
  Mail Utilities
  Daemon interface
  PHP Extension
  System Library
  History

SourceForge
  pMailAdmin
  vpopmail
  qmailadmin

inter7
  vpopmail
  qmailadmin

VPOPMailWiki
vpopmail_util - PHP functions to manage an email server.

This file will provide a number of high level functions that understand common structures used in managing an email server, like Black Holes, CatchAll accounts, Forwards, Lists, Mailboxes, Robots and Spam Traps. So far I don't see much use in putting them into an object.

Vpopmail library to provide high level services.

It currently contains the following functions:

===================================================================

Generic functions:


function DotQmailSplit( $FileContents ) {

Search an array ($FileContents) holding one line of a .qmail file
per entry, in the order lines appear in the file.  It returns an
array containing four elements named 'Comment', 'Program', 'Delivery',
and 'Forward'.  The data for each of these elements is an array
containing the lines of that type from the incoming data.

This is a good first step in processing a .qmail file since it
simplifies the structure.

===================================================================

Catchall functions:

function CatchallGet( $Domain ) {

Return the Catchall setting from the .qmail-default of the
specified domain.  Possible return values are:

Deleted.

Bounced.

Delivered to local_user

Forward address@domain.com


-------------------------------------------------------------------

function CatchallSet( $Domain, $Catchall ) {

Set the Catchall status of $Domin, by rewriting the .qmail-default
file for the domain.  $Catchall is a string containing one of the
following:

   'Deleted',  'Bounced',   'Delivered to local_user', 
   'Forward address@domain.com'

local_user must be a valid user within $Domain.  Delivery will
be direct to the Maildir of the user.  This function verifies
the user, and will fail if it is not valid.

address@domain.com can be any valid email address.  The message
will be passed back to qmail for processing. No checking is done
to the address selected.


===================================================================

Mail Robot functions:

function RobotDel( $Domain, $User ) {

Delete a MailRobot.

Returns false if the robot was deleted, or true and sets the
error state in the object for retrieval with ErrorMessage();

Possible error values include:

Not a robot.
Unable to delete directory.
Unable to delete dotqmail file.


-------------------------------------------------------------------

function RobotSet( $Domain, $User, $Subject, $Message, 
                   $Forward, $Time=VPOPMAIL_ROBOT_TIME,
                   $Number=VPOPMAIL_ROBOT_NUMBER ) {

Create a mail robot at address  $User@$Domain.

$Subject = (string) The subject for the returned message.

$Message = (array) The message, one line per element in the array.

$Forward = (string) A single address which receives a copy of
                    each received message.  

           -- or --

           (array)  An array with one address per entry.  Each
                    listed address will receive a copy of the
                    received message.

$Time = (integer) Number of seconds used by Autorespond program.
        Default is set within the object, to 10000.

$Number = (integer)  Number of messages used by Autorespond 
        program.  Default is set within the object, to 5.


-------------------------------------------------------------------

function RobotGet( $Domain, $User ) {

Return an array containing information about a mail robot.

array(
   'Time' => 10000,
   'Number' => 5,
   'Subject' => 'Some Subject',
   'Forward' => $ForwardInformation,
   'Message' => array( 
      'This is the first line',
      'This is the second line',
      'This is the third line',
      'This is the last line',
      ),
   )

$ForwardInformation may be either a string, or an array.  The
string is a single address that incoming messages are forwarded
to.  An empty string specifies no forwarded message.  An array
contains one address per entry if there is more than one.



©2004 - Rick Widmer
Released under the PHP License
sourceforge.net Logo