building a messaging server part seven

Scripting

Creating the email addresses and domains in this setup requires several repetitive tasks. As a result, I've created two python scripts to help out.

The first script, EmailAddressAdmin, provides some simple administrative tasks for email addresses. The second, EmailDomainAdmin, creates and deletes email domains.

Email Address Admin

Here's a quick tutorial-by-example on how to use the EmailAddressAdmin.

$ python
>>> from EmailAddressAdmin import *
>>> e = EmailAddressAdmin('barry@server1.local')
>>> e.exists()
False
>>> e.createAddress('password','owner')
True
>>> e.changePassword('newpw')
True
>>> e.spacedUsed()
2342
>>> e.suspend()
True
>>> e.unsuspend()
True
>>> e.deleteAddress()
True
>>>

Email Domain Admin

And here's a quick tutorial of EmailDomainAdmin

$ python
>>> from EmailDomainAdmin import *
>>> d = EmailDomainAdmin('server3.local')
>>> d.exists()
False
>>> d.create()
>>> from EmailAddressAdmin import *
>>> e = EmailAddressAdmin('joe@server3.local')
>>> e.createAddress('password','owner')
True
>>> d2 = EmailDomainAdmin('server1.local')
>>> for address in EmailDomainAdmin.listAddresses():
... e = EmailAddressAdmin(address)
... print e.spaceUsed()
...
2342
36
1024
>>>

What's Missing

Though these two scripts serve as a good starting point, they're still missing some features.

The EmailAddressAdmin script does not support aliases. Easy enough to implement, I just haven't yet. Vacation and out-of-office messages are not implemented as well.

Also, neither script does any work with the 'owner' fields in the domain and address files. It would be nice to be able to search by owner for both a domain and address. This would work great with a web interface where a user would log in with their main shell account and be presented with a list of the domains and addresses they own.