PostfixAdmin

PostfixAdmin will allow you to add, delete and edit mailboxes and full domains. This web based app access you MySQL config for postfix and edits it directly.

Using Apache
yum install httpd mysql mysql-server php php-mysql php-mbstring subversion Now setup the programs to start up when the system start then start them. /sbin/chkconfig httpd on /sbin/chkconfig mysqld on /sbin/service httpd start /sbin/service mysqld start

Using Lighttpd
yum install lighttpd mysql mysql-server php-mysql subversion To use Lighttpd you need to configure your lighttpd.conf file, add something like below cgi.assign = ( ".php" => "/usr/bin/php-cgi" ) Now setup the programs to run properly /sbin/chkconfig lighttpd on /sbin/chkconfig mysqld on /sbin/service lighttpd start /sbin/service mysqld start
 * /etc/lighttpd/lighttpd.conf

Creating MySQL Databases and Permissions
First we need to create the databases for Postfix.

As root run the following mysqladmin create postfix Now we need to create a user to use with Postfix. mysql grant all on postfix.* to postfix@"localhost" identified by "postfix"; Assuming both those commands finished successfully you can exit mysql. exit You have now added the needed databases and user and gave then the correct permissions.

PostfixAdmin Download and Install
We will be using the Subversion version of Postfix Admin. First you need to deside where you would like your Postfix Admin install to live, mine will live under apache's root dirctory

With Apache
cd /var/www/html/ svn co https://postfixadmin.svn.sourceforge.net/svnroot/postfixadmin/trunk postfixadmin cd postfixadmin

With Lighttpd
cd /var/www/lighttpd/ svn co https://postfixadmin.svn.sourceforge.net/svnroot/postfixadmin/trunk postfixadmin cd postfixadmin Now you have the current version of Postfix Admin.

PostfixAdmin Config File
First thing to do is to tell postfix that you have configure the app $CONF['configured'] = true; The full url of your postfix admin build $CONF['postfix_admin_url'] = 'https://mail.example.com/postfixadmin';
 * /var/www/html/postfixadmin/config.inc.php

Database Setup
Next you need to setup your database connection. Since I'm using MySQL this is my setup. I think the setup is pretty self explanatory. $CONF['database_type'] = 'mysql'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'postfix'; $CONF['database_password'] = 'postfix'; $CONF['database_name'] = 'postfix'; $CONF['database_prefix'] = ''; The email address that all problems will be reported to and the sender of site wide messages. $CONF['admin_email'] = 'postmaster@example.com'; The location and port of the SMTP server for site messages. $CONF['smtp_server'] = 'localhost'; $CONF['smtp_port'] = '25'; In what way do you want the passwords to be crypted? $CONF['encrypt'] = 'md5'; Minimum length required for passwords. (Admins can set shorter passwords but users can't) $CONF['min_password_length'] = 7; The default aliases that need to be created for all domains. $CONF['default_aliases'] = array (    'postmaster' => 'postmaster@example.com', );

Mailbox Setup
If you want to store the mailboxes per domain set this to 'YES'. (Example: /usr/local/virtual/example.com/username@example.com $CONF['domain_path'] = 'YES'; If you don't want to have the domain in your mailbox set this to 'NO'. (Example: /usr/local/virtual/example.com/username) $CONF['domain_in_mailbox'] = 'YES'; Default Domain Values. Specify your default values below. Quota in MB. $CONF['aliases'] = '0'; $CONF['mailboxes'] = '0'; $CONF['maxquota'] = '512';       (NOTE: Postfix dose NOT understand quota's and will not enforce them)

Transport Setup
If you want to define additional transport options for a domain set this to 'YES'. $CONF['transport'] = 'YES'; If you want to define additional transport options put them in array below. $CONF['transport_options'] = array (    'virtual',  // for virtual accounts     'local',    // for system accounts     'relay'     // for backup mx ); Transport default $CONF['transport_default'] = 'virtual';

Virtual Vacation Setup
If you want to use virtual vacation for you mailbox users set this to 'YES'. (NOTE: Make sure that you install the vacation module. http://high5.net/postfixadmin/) $CONF['vacation'] = 'YES'; This is the autoreply domain that you will need to set in your Postfix transport maps to handle virtual vacations. It does not need to be a real domain (i.e. you don't need to setup DNS for it). $CONF['vacation_domain'] = 'vacation.example.com'; If you want users to take control of vacation set this to 'YES'. $CONF['vacation_control'] ='YES'; Set to 'YES' if your domain admins should be able to edit user vacation. $CONF['vacation_control_admin'] = 'YES';

Alias Control
Postfix Admin inserts an alias in the alias table for every mailbox it creates. The reason for this is that when you want catch-all and normal mailboxes to work you need to have the mailbox replicated in the alias table. If you want to take control of these aliases as well set this to 'YES'. $CONF['alias_control'] = 'YES';

Alias Control for admins. $CONF['alias_control_admin'] = 'YES';

Welcome Message
This message is send to every newly created mailbox. $CONF['welcome_text'] = <<<EOM Hi, Welcome to your new account. EOM;

When creating mailboxes, check that the domain-part of the address is legal by performing a name server look-up. $CONF['emailcheck_resolve_domain']='YES';

PostfixAdmin Webbased Setup
Next go to the URL that you have set in PostfixAdmin, and go to the setup page. http://mail.example.com/postfixadmin/setup.php This page will setup the database for you and also test your system to confirm its all running correctly.

Installing PostfixAdmin's Virtual Vacation Prerequisites
First we need to install some required Perl modules via CPAN cpan> install MIME::EncWords ... cpan> install MIME::Charset Then via yum yum install perl-DBD-MySQL perl-Email-Valid perl-Mail-Sendmail perl-Log-Log4perl

Configuring PostfixAdmin's Virtual Vacation
Next were going to need to add the Vacation unix Account. To add a entry like run something like this: adduser -d /var/spool/vacation -s /sbin/nologin -r vacation Now copy the vacation.pl script into your new directory cp /var/www/html/postfixadmin/VIRTUAL_VACATION/vacation.pl /var/spool/vacation chown vacation:vacation /var/spool/vacation/vacation.pl Next we need to work in the PostfixAdmin Config File.
 * /var/www/html/postfixadmin/config.inc.php

If you want to use virtual vacation for you mailbox users set this to 'YES'. (NOTE: Make sure that you install the vacation module. http://high5.net/postfixadmin/) $CONF['vacation'] = 'YES'; This is the autoreply domain that you will need to set in your Postfix transport maps to handle virtual vacations. It does not need to be a real domain (i.e. you don't need to setup DNS for it). $CONF['vacation_domain'] = 'vacation.example.com'; If you want users to take control of vacation set this to 'YES'. $CONF['vacation_control'] ='YES'; Set to 'YES' if your domain admins should be able to edit user vacation. $CONF['vacation_control_admin'] = 'YES';

Configuring PostfixAdmin's Virtual Vacation script in Postfix
Next we need to modify the /etc/postfix/master.cf & /etc/postfix/main.cf files. vacation unix  -       n       n       -       -       pipe flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} ${recipient} transport_maps = hash:/etc/postfix/transport And in the transport file add: vacation.example.com  vacation: The vacation.example.com domain but be the same as: $CONF['vacation_domain'] = 'vacation.example.com'; Is set in the PostfixAdmin's config.inc.php file. Then build the map file postmap /etc/postfix/transport
 * /etc/postfix/master.cf
 * 1) PostfixAdmin Vacation Bounceback Filter
 * /etc/postfix/main.cf