Automated List Server for hMailServer

This section contains scripts that hMailServer has contributed with. hMailServer 4 is needed to use these.
Post Reply
gsmaclean
Normal user
Normal user
Posts: 47
Joined: 2008-04-16 18:35

Automated List Server for hMailServer

Post by gsmaclean » 2008-05-05 21:54

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: Select all

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.com
Subject: 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: Select all

# 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!
Attachments
ListServ.zip
List Server functionality for hMailServer
(4.48 KiB) Downloaded 903 times

ewieldra
Normal user
Normal user
Posts: 37
Joined: 2008-04-24 23:23
Location: The Netherlands

Re: Automated List Server for hMailServer

Post by ewieldra » 2008-06-10 23:51

@gsmaclean

Very very very NICE

and no response from anyone..

Thank you
Best regards,

Emiel Wieldraaijer
The Netherlands

ewieldra
Normal user
Normal user
Posts: 37
Joined: 2008-04-24 23:23
Location: The Netherlands

Re: Automated List Server for hMailServer

Post by ewieldra » 2008-06-11 15:36

@gsmaclean

works perfect..

Things missing in your small manual (not really missing just not well explained)

"For instance, if you have added listserv@acme.com, and you have a mailing list with an address of "mail-list@acme.com",
-> Create a distribution list, this will be the name of the mailinglist, in the above example "mail-list"
-> Note for configuration -> Check Mode option in Distribution lists otherwise everyone can send email to the mailinglist
Best regards,

Emiel Wieldraaijer
The Netherlands

User avatar
JonnyBee
Normal user
Normal user
Posts: 31
Joined: 2008-06-20 05:02
Location: The Land of the Blazing Sun

Re: Automated List Server for hMailServer

Post by JonnyBee » 2008-07-26 04:13

Wow - how cool -

this was about #2 or #3 in my wish list. I have been hobbling along with 3rd party listserver. awkward and ugly...

Now I have a project for September - AND its gonna be my birthday!

thanks for an in-advance present...

8)
--- once again thanking Martin --- all hail mighty Martin ---

ewieldra
Normal user
Normal user
Posts: 37
Joined: 2008-04-24 23:23
Location: The Netherlands

Re: Automated List Server for hMailServer

Post by ewieldra » 2008-08-24 14:46

@gsmaclean

The script does not work 100% perfect for me


This error is reported in my HmailServer error log files

"Script Error: Source: Runtime error Microsoft VBScript - Error: 800A01A8 - Description: Object required : 'FS2' - Line: 325 Column: 26 - Code: (null)"

it's this line If Not Found Then FS2.WriteLine TxtLin ' Not found, write the old line out
I get this error while someone is in the file ListServSubReqs.txt

i think FS2 is not correct -> could you confirm this ?

Thnx
Best regards,

Emiel Wieldraaijer
The Netherlands

ewieldra
Normal user
Normal user
Posts: 37
Joined: 2008-04-24 23:23
Location: The Netherlands

Re: Automated List Server for hMailServer

Post by ewieldra » 2008-08-24 15:35

I Think the FS2 should be FO2
Best regards,

Emiel Wieldraaijer
The Netherlands

gsmaclean
Normal user
Normal user
Posts: 47
Joined: 2008-04-16 18:35

Re: Automated List Server for hMailServer

Post by gsmaclean » 2008-10-03 22:37

Correct, that FS2 should be FO2. Corrected version attached.
Attachments
ListServ.zip
(4.48 KiB) Downloaded 728 times

init
New user
New user
Posts: 2
Joined: 2008-10-07 10:58

Re: Automated List Server for hMailServer

Post by init » 2008-10-07 11:42

hi there..
im using your mailing-list script, and its great!

all the mails to listserv@domain wouldt be sent to this account, but i want to send the mails to this account... how i change the script?

i think its this line!

Code: Select all

Result.Value = 1 ' Don't deliver this message
your help would be great
thanks

init
New user
New user
Posts: 2
Joined: 2008-10-07 10:58

Re: Automated List Server for hMailServer

Post by init » 2008-10-07 12:02

its me again...

how can i set the permissions to ad remote users and list users?
i still get the answer Command Denied

Ad remote user
I send "subscribe mylist user@domain.ch" to listserv
and i get the answer "You do not have permissions to perform the requested command ..."


list user
I send "list mylist" to listserv
and i get the answer "You do not have permissions to perform the requested command ..."

thanks a lot!

User avatar
urgje
New user
New user
Posts: 26
Joined: 2008-03-18 13:52
Location: The Netherlands

Re: Automated List Server for hMailServer

Post by urgje » 2008-10-27 13:06

Hi gsmaclean

Great script. Thanks a lot! This was the last thing that's kept me from finally moving from MailEnable to hMailServer. The automatic greylist - whitelisting script was the other topic. Now the move has been completed and things are working perfectly okay.
On my working list I have the tranlation of your script to Dutch. Can you tell me which lines can / need to be translated and which ones to leave well alone?
Tranlation may take a while, but anyone interested (or already busy doing just this); contact me at urgje@dds.nl.
I still have to shrink, to grow up.
Urgofrodel Heul

nahyah
New user
New user
Posts: 1
Joined: 2008-12-08 20:10

Re: Automated List Server for hMailServer

Post by nahyah » 2008-12-09 02:11

Thanks for great work!!

Unfortunately I have not have it working 100% yet.
The script loads fine and passes syntax check, but when i send email to listserv@xxxx.com, nothing happens. I reloaded it after making sure all the setting are correct.
The lists folder does contain the two files you mentioned in the first post but, i did not get any replys nor the email address was added to the distribution list

Can you help me please?

Thank you.

xen
New user
New user
Posts: 1
Joined: 2008-12-13 20:43

Re: Automated List Server for hMailServer

Post by xen » 2008-12-13 20:55

Hello! Sorry for my English.
I could adjust hMailServer and a script for the organisation of an automatic subscription and unsubscription to mail lists. Subscribe/unsubscribe work well. But! At sending of letters they do not come to dispatch to subscribers! In what there can be a problem? At addition of addresses manually all works. I use a stable release of hMailServer v4.4.3. In advance thanks for the answer.

perast
New user
New user
Posts: 6
Joined: 2011-02-09 16:44

Re: Automated List Server for hMailServer

Post by perast » 2011-02-14 22:17

This script, will it works with hMailServer 5.3.3 - Build 1879 with MySql.

gsmaclean
Normal user
Normal user
Posts: 47
Joined: 2008-04-16 18:35

Re: Automated List Server for hMailServer

Post by gsmaclean » 2011-02-14 22:28

perast wrote:This script, will it works with hMailServer 5.3.3 - Build 1879 with MySql.
I am using it on 5.3.3 B1879 under MSSQL with no problems.

perast
New user
New user
Posts: 6
Joined: 2011-02-09 16:44

Re: Automated List Server for hMailServer

Post by perast » 2011-02-15 21:02

OK TANKS

Now, I have a problem.


I have a mailacount listserv@xxxxxxx.xx

I Have a distributions list newsletter@xxxxxx.xx

When i send a mail to listserv@xxxxxx.xx with "subject : subscribe list" , I get this error:

"ERROR" 1228 "2011-02-15 19:47:27.519" "Script Error: Source: Körningsfel i Microsoft VBScript - Error: 800A01A8 - Description: Objekt krävs.: 'GetList(...)' - Line: 151 Column: 2 - Code: (null)"

The line is:

Set oDistributionList = GetList(ListName, Domain) ' Retrieve the reference to the appropriate distribution list object

perast
New user
New user
Posts: 6
Joined: 2011-02-09 16:44

Re: Automated List Server for hMailServer

Post by perast » 2011-02-21 23:58

I fix it.

celaretaudax
New user
New user
Posts: 5
Joined: 2009-06-07 17:03

Re: Automated List Server for hMailServer

Post by celaretaudax » 2012-06-25 10:24

hi perast,

I'm getting a similar arror to yours:

"ERROR" 2352 "2012-06-25 09:10:01.538" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A01A8 - Description: Object required: 'GetList(...)' - Line: 152 Column: 2 - Code: (null)"
"APPLICATION" 2352 "2012-06-25 09:10:01.616" "SMTPDeliverer - Message 45715: Message delivery thread completed."

Please could you tell me how you fixed it or have done something silly ?
I sent the 1st email successfully which created the TXT files as per the instructions but now I tried to subscribe from aonter email to the same list.
It's then when I started to get this error.

Regards
Leo

simonjshaw
New user
New user
Posts: 12
Joined: 2013-02-06 13:09

Re: Automated List Server for hMailServer

Post by simonjshaw » 2013-04-12 12:49

I am getting an error when I try to send the first subscribe message.

I am sending to listserv@mydomain
with
subscribe listname
in the subject

No files are created, I get no response, and the error log shows....

"ERROR" 1316 "2013-04-12 11:45:46.361" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A01A8 - Description: Object required: 'GetList(...)' - Line: 151 Column: 2 - Code: (null)"

Any suggestions?

User avatar
mattg
Moderator
Moderator
Posts: 20540
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Automated List Server for hMailServer

Post by mattg » 2013-04-12 14:06

What version of hMailserver are you using?
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

simonjshaw
New user
New user
Posts: 12
Joined: 2013-02-06 13:09

Re: Automated List Server for hMailServer

Post by simonjshaw » 2013-04-12 14:25

Should have said...
5.3.3 Build 1879 with MSSQL CE

User avatar
mattg
Moderator
Moderator
Posts: 20540
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Automated List Server for hMailServer

Post by mattg » 2013-04-12 14:35

This version of the script (this thread) is for version 4.X of hMailserver
The COM API changed significantly between version 4.X and 5.X, hence the separate forums.

This script was re-written for Ver 5.0 - http://www.hmailserver.com/forum/viewto ... 20&t=15301
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

perrynewton
New user
New user
Posts: 13
Joined: 2010-11-12 13:22

Re: Automated List Server for hMailServer

Post by perrynewton » 2013-07-05 14:55

I would like to be able to read my list of recipients from an external file (actually from an access database which is my membership database on which I would do a query on some criteria)

Can anyone give me a pointer as to where in the code I should start to replace the Hmailserver DL stuff and put in my code to read my database, returning the equivalent email addresses? On even as a simple first step to just read an external text file.

Of course the list management (subsubcribe/unsubscribe etc) would be redundant but I accept that. So, in due course I might put something in the "list" address to indicate whether to use the current processing or read externally. (eg dblist_mynames@..")

Gordonh1970
Normal user
Normal user
Posts: 42
Joined: 2016-01-29 13:50
Location: UK
Contact:

Re: Automated List Server for hMailServer

Post by Gordonh1970 » 2016-06-30 19:00

Just wanted to say thank you very much for creating this

I run a few dozen different distribution lists for various clubs etc on my hMailServer and was looking for something to do exactly this

Thank you so very much 10/10 :D :D :D :D :D :D :D :D :D

User avatar
jimimaseye
Moderator
Moderator
Posts: 8300
Joined: 2011-09-08 17:48

Re: Automated List Server for hMailServer

Post by jimimaseye » 2016-06-30 21:49

Gordonh1970 wrote:Just wanted to say thank you very much for creating this

I run a few dozen different distribution lists for various clubs etc on my hMailServer and was looking for something to do exactly this

Thank you so very much 10/10 :D :D :D :D :D :D :D :D :D
Did you use the latest v5 with all its mods and fixes (from here: viewtopic.php?p=141473#p141473) ?
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

Gordonh1970
Normal user
Normal user
Posts: 42
Joined: 2016-01-29 13:50
Location: UK
Contact:

Re: Automated List Server for hMailServer

Post by Gordonh1970 » 2016-07-02 00:18

jimimaseye wrote:Did you use the latest v5 with all its mods and fixes (from here: viewtopic.php?p=141473#p141473) ?
Nope but off to look at it now, a new toy to play with :)

Post Reply