Hi. Here it's my latest release of dbmail.sh.

After the comment of Paul J Stevens about the advantages of the
independece of the DBMail daemons and the MTA (postfix in my case), I made
some tweaks to dbmail.sh.

My script it's made from start to be domain aware, which I believe it's a
main feature, but I recognize the advantages of been able to control a
DBMail instance even if the server is installed outside of the mail
transport agent, or even if you are using a different mail transport.

So I decide to change my approach, and use SQL statements instead of plain
text files, thanks to the post of Jacques-Beaudoin. I change Postfix to
use a mysql table instead of the dbm transport file. So, now I obtain the
domain list and the domain user list directly from the database. I still
use standard dbmail commands to create, delete and update user parameters,
since they are bulletproof.

These are the steps to configure Postfix to use a mysql table as source
for the transport maps:

1. Create table transport in dbmail database:

CREATE TABLE transport (
  domain varchar(255) NOT NULL default '',
  transport varchar(8) default NULL,
  PRIMARY KEY  (domain)
) TYPE=MyISAM;

INSERT INTO transport VALUES ('localhost','dbmail:');

2. Create the file /etc/postfix/transport.cf with the following lines:

user = dbmail                   # Authorize user
password = mailmanager          # User password
dbname = dbmail                 # database name
table = transport               # table name
select_field = transport
where_field = domain
hosts = localhost               # Your mysql server


3. Update /etc/postfix/main.cf to use mysql to transport. insted of dbm

transport_maps = mysql:/etc/postfix/transport.cf

Even if you don't use Postfix, you can still create the new table to
dbmail, and enjoy the advantages of using a full featured tool.

To use the script, you only need to adjust the header to your location
settings.


TODO

1. Add some routines to check terminal size, to take advantage of larger
consoles (more that 80x24).
2. Learn how to directly assign variables for menuitem.$$ instead of the
redirection/cat assign procedure to improve speed.
3. Add some other postfix functions, like spool cleaning or ETRN to
improve the value of this tool.
4. Add a routine to ask to delete all users from a domain when deleting
domain.
5. Add support to fetchmail configuration (a most wanted). I think I will
have a release next week.
6. Still waiting for dbmail public folders!!!

Regards,

Alejandro MarĂ­n
Consultant

Attachment: dbmail.sh
Description: Binary data

Reply via email to