SmatrCGI Logo
  
Home News Products Customers Contact us
     
Web Development

About
Portfolio
Prices
Contact us

Web Design

About
Portfolio
Prices
Contact us

Translating

About
Languages
Prices
Contact us


Web development

Postfix and MySQL integration


Since we have enabled Postfix to support MySQL we can use it to store users and domains informations into MySQL tables. It speeds up and allows to manage our domains from any Perl or PHP script. All tables will be located at /etc/postfix/mysql/ directory.

Relay access table

In this table we will put hosts that can relay over our system all the time. Like computers on your network, your customers & so on.
    /etc/postfix/mysql/access.conf:
    
    user = postfix
    password = pass123
    dbname = postfix
    table = access
    select_field = action
    where_field = ip
    hosts = localhost
    
Field action should be one of "OK" or "REJECT". Field ip should have full ip address or wildcard ip address like "10.10."

POP-before-SMTP table

In this table our POP3 and IMAP server will add ip addressed of users who has authorized successfully and can send emails without authorizations. Structure is the same as 'Relay access table'.
    /etc/postfix/mysql/pop-before-smtp.conf:
    
    user = postfix
    password = pass123
    dbname = postfix
    table = relay_ip
    select_field = 1
    where_field = ip
    hosts = localhost
    

Aliases table

If you a user has several accounts and want to get them into single box or user wants to get his emails at another domain/ISP we can use this table to forward emails.
    /etc/postfix/mysql/aliases.conf:
    
    user = postfix
    password = pass123
    dbname = postfix
    table = aliases
    select_field = rcpt
    where_field = alias
    hosts = localhost
    
Field alias has user's email and field 'rcpt' has another user's email address where emails will be forwarded to.

Transport table

if you have UUCP or any another specific protocols to deliver email you can use this table to specify transport. In regular mailboxes we use 'virtual:' transport for maildir & mailbox delivery.
    /etc/postfix/mysql/transport.conf:
    
    user = postfix
    password = pass123
    dbname = postfix
    table = transport
    select_field = transport
    where_field = domain
    hosts = localhost
    

Users table

And finally we need a table to store our users' account information. if you have UUCP or any another specific protocols to deliver email you can use this table to specify transport. In regular mailboxes we use 'virtual:' transport for maildir & mailbox delivery.
    /etc/postfix/mysql/transport.conf:
    
    user = postfix
    password = pass123
    dbname = postfix
    table = transport
    select_field = transport
    where_field = domain
    hosts = localhost
    
All these tables can be taken at http://smartcgi.com/dist/postfix/config/postfix/.

© Copyright 1999 - 2004 SmartCGI, Inc. All Rights Reserved.