One of the things I was missing with hMailServer that I had with IMail was the ability for users to join and leave mailing lists on their own, through an email interface. I decided to write one myself to return this functionality to my users.
This is not a simple script (it is almost 20K) and it gives basic (but secure) functionality. It is fairly bare in terms of functionality and appearance, but it does work.
There are a few things you need to configure in the script before you run it. Find these lines (near the top):
Code:
ListDataDir = "C:\Program Files\hMailServer\Lists\" ' Including trailing backslash!
AdminUser = "administrator"
AdminPass = "yourpassword"
The first item is the directory you want the list server to store its data files. Make sure you include the trailing backslash! For most installations, the default will work fine.
The second and third items are the standard hMailServer administrative username and password.
Paste the code into your EventHandlers.vbs file. Make sure that if you already have code in your OnDeliveryStart event, that you integrate this code and don't overwrite your existing code.
After you have loaded the script in, the next step is to create a normal user named "listserv" in any domains that have mailing lists that you want to automate. The password does not matter, as the mail user will not actually be utilized.
Now we will make the script create default configuration files. From an email client, send an email to the listserv account that you created. In the subject line, type "subscribe xxxxx" where xxxxx is the name of one of the mailing lists that exists on that domain.
For instance, if you have added
listserv@acme.com, and you have a mailing list with an address of "mail-list@acme.com", then create an email as such:
From: your name here <youremailaddress@here>
To:
listserv@acme.comSubject: subscribe mail-list
Send this blank email. The server will respond with a validation email message. This is how users will normally be verified, to keep people from forging subscribe requests.
Next, check the ListDataDir that you specified above (it will have been created automatically). You will see two files in there - the one we are interested in is called ListServLists.txt. Open it with a text editor. You will see the following:
Code:
# ListServLists.txt - for use with custom list server script
# Lines prefaced with # are ignored
#
# Syntax of this file (one permission per line):
# ListName@Domain Permission
#
# Valid Permissions:
# SUBSCRIBE - Users can join lists via email
# SUBSCRIBE_O - Users can subscribe other users to lists via email
# UNSUBSCRIBE - Users can leave lists via email
# LIST - Users can retrieve list of all other users on list
#
# Example:
#
# techhelp@acme.com SUBSCRIBE
# techhelp@acme.com UNSUBSCRIBE
mail-list@acme.com SUBSCRIBE
mail-list@acme.com SUBSCRIBE_O
mail-list@acme.com UNSUBSCRIBE
There will be a "SUBSCRIBE", a "SUBSCRIBE_O" and "UNSUBSCRIBE" entry for every active mailing list on your server. You should delete any of the entries that you do not want to allow public sub/unsub access to. Once you have edited this file to your liking, save it.
The list server is now active, with the permissions you specified in the ListServLists.txt file.
I have this operating on my server now, and it seems to be running well. I will likely expand it in future to allow custom response messages for individual lists and so on, but for the moment it does what I need it to. Any questions, please ask!