Author Topic: Mailbox Alias SQL ("alias") Plugin  (Read 5274 times)

Offline llamaX

  • Newbie
  • *
  • Posts: 1
Mailbox Alias SQL ("alias") Plugin
« on: June 09, 2011, 11:21:19 AM »
Hello,

I've hacked together a little plugin that allows users to manage (create, update, delete) multiple mailbox aliases via an SQL back end.  It's largely based on the Postfixadmin Forwarding plugin code, although my database structure is completely different.  This is my first plugin attempt so I've no doubt done everything horribly wrong.  I'm attaching it here in case anyone is interested, but go ahead and consider it abandonware.  I'm not planning on actively keeping it updated since I'm just that lazy.

Here is the SQL table I use:
Code: [Select]

CREATE TABLE `mailboxes` (
  `uid` smallint(1) NOT NULL AUTO_INCREMENT,
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '''''',
  `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '''''',
  `forward` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '''''',
  `alias` tinyint(1) NOT NULL DEFAULT '0',
  `greylist` tinyint(1) NOT NULL DEFAULT '0',
  `quota` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uid`),
  UNIQUE KEY `address` (`address`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


Here are a couple sample entries:
Code: [Select]

+-----+--------+---------------------+---------------------+-------------------+---------------------------+------------------+-------+----------+-------+
| uid | active | created             | modified            | address           | password                  | forward          | alias | greylist | quota |
+-----+--------+---------------------+---------------------+-------------------+---------------------------+------------------+-------+----------+-------+
|   3 |      1 | 2011-06-05 23:18:55 | 2011-06-05 23:47:13 | user@example.com  | YourPasswordEncryptedHere | ''               |     0 |        1 |     0 |
|   4 |      1 | 2011-06-05 22:21:10 | 2011-06-05 22:21:10 | alias@example.com | ''                        | user@example.com |     1 |        0 |     0 |
+-----+--------+---------------------+---------------------+-------------------+---------------------------+------------------+-------+----------+-------+


Feedback welcome.