メールをデータベースで:Postfix + postgresql 編
apt-get install postfix postfix-pgsql apt-get install dbmail2-pgsql データベースのユーザ作成 createdb -O dbmail dbmail createuser -P dbmail /usr/share/doc/dbmail2-pgsql/examples/create_tables.pgsql.gz を展開して実行 postgresのアクセス権設定 /etc/dbmail/dbmail.conf を編集 ユーザの追加 dbmail-users -a foo@example.com -p md5 -w pass
http://www.dbmail.org/dokuwiki/doku.php?id=manage_users
ここを参考にpostfixの設定
ビューを作成
CREATE VIEW postfix_users AS SELECT username FROM ( SELECT userid AS "username" FROM dbmail_users UNION SELECT alias AS "username" FROM dbmail_aliases ) x WHERE x.username ~ '\\w\@\\w';
/etc/postfix/master.cfを編集
local_recipient_maps = pgsql:/etc/postfix/sql-recipients.cf
/etc/postfix/sql-recipients.cfを編集
user = dbmail password = pass hosts = localhost dbname = dbmail table = postfix_users select_field = username where_field = username