Distribution list enhancement

This section contains scripts that hMailServer has contributed with. hMailServer 5 is needed to use these.
User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-03-04 15:46

P.S., y'all, if anyone has downloaded my package before March 4, I had left a call to a "CopyMessageToSharepointDropFolder(oMessage)" function in the OnDeliverMessage sub. But I remembered this just this morning and removed it, as it doesn't belong to the ListServer script.

I've updated the package to reflect this, but didn't change the version number.

User avatar
Caspar
Senior user
Senior user
Posts: 377
Joined: 2008-09-08 11:47
Contact:

Re: Distribution list enhancement

Post by Caspar » 2013-03-04 17:10

brother.gabriel wrote:Caspar, in the beginning I annotated everywhere in the script where I made a change, but in the last round, I made so many that I gave up on that. If you want a line-by-line, you'll have to use a file-comparitor such as WinMerge.

If your intention is to check with the backward compatibility of the script with hMailServer 4, I think I did, indeed break it.

Also, I'm not sure what you mean by referencing "hMailServer documentation" - I've made no changes to hMailServer at all - just to the ListServer script. My documentation is all there. I'd be interested to know what you think. The links are in my previous post.
I meant for the documentation here:
http://www.hmailserver.com/documentatio ... e=overview

if you have some specific changes you can remember, I could have some use of it to make updating the documentation there more easy.
If you have strange problems or errors use the log analyzer! http://log.damnation.org.uk
Join us on IRC! http://hmailserver.com/irc_fullscreen.php

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

Re: Distribution list enhancement

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

I cannot download the latest script package - getting 404 error.
Can someone post a valid link to it?

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Distribution list enhancement

Post by Bill48105 » 2013-04-12 16:04

simonjshaw wrote:I cannot download the latest script package - getting 404 error.
Can someone post a valid link to it?
You mean the attachments on 1st post?
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

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

Re: Distribution list enhancement

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

Okay I'm being stupid I expect. Something to do with age - please be patient.
I see attachments on the first post and can download them.

But I saw that first Peter and then Br Gabriel updated the script, and was trying to download the latter from his site.
that was what I wanted - latest script.
Anyway I used Peter's.

I cannot find much documentation which tells me step by step how to set up this list server, so I'm making lots of assumptions, maybe false ones:

I created a user listserv@mydomain
I created a distribution list mylist@mydomain

I got the paths sorted out and created config file called listserv_at_mydomain.txt

It won't process a subscription from me send to listserv@mydomain

I get (I've replaced real values with listname and mydomain below):

"12/04/2013 15:00:53" "Subject: subscribe listname"
"12/04/2013 15:00:53" " Starting mail configuration check"
"12/04/2013 15:00:53" " Recipient: listserv@mydomain"
"12/04/2013 15:00:53" " Reading config file: c:\ListServData\listname_at_mydomain.txt"
"12/04/2013 15:00:53" " admin=simon@mydomain"
"12/04/2013 15:00:53" " operator=or"
"12/04/2013 15:00:53" " todo=delete"
"12/04/2013 15:00:53" " pw_enclosure=#"
"12/04/2013 15:00:53" " allowmembers=true"
"12/04/2013 15:00:53" " addsenderheader=list"
"12/04/2013 15:00:53" " addreplytoheader=list"
"12/04/2013 15:00:53" " smtpmailfrom=list"
"12/04/2013 15:00:53" " subjectprefix=%address%: "
"12/04/2013 15:00:53" " failure_notification=true"
"12/04/2013 15:00:53" " failure_notification_subject=Delivery Failure"
"12/04/2013 15:00:53" " failure_notification_file=failure_notification.txt"
"12/04/2013 15:00:53" " success_notification=false"
"12/04/2013 15:00:53" " success_notification_subject=Successful delivery"
"12/04/2013 15:00:53" " success_notification_file=success_notification.txt"
"12/04/2013 15:00:53" " header_file=header.txt"
"12/04/2013 15:00:53" " footer_file=footer.txt"
"12/04/2013 15:00:53" " header_file_html=header_html.txt"
"12/04/2013 15:00:53" " footer_file_html=footer_html.txt"
"12/04/2013 15:00:53" " attach_recipients_to_footer=true"
"12/04/2013 15:00:53" " attach_recipients_delimiter=; "
"12/04/2013 15:00:53" " attach_recipients_html=<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>%recipients%</span></font></p>"
"12/04/2013 15:00:53" " email_subscription=true"
"12/04/2013 15:00:53" " email_subscription_admin_notification=true"
"12/04/2013 15:00:53" " email_subscription_allowed_cmds=help#list#subscribe#subscribeaddress#subscribelist#unsubscribe#unsubscribeaddress#unsubscribelist"
"12/04/2013 15:00:53" " email_subscription_success_notification=true"
"12/04/2013 15:00:53" " email_subscription_failure_notification=true"
"12/04/2013 15:00:53" " Subscription via email activated."
"12/04/2013 15:00:53" " This is not a distribution list!"
"12/04/2013 15:00:53" " Checking recipient: listserv@mydomain"
"12/04/2013 15:00:53" " Member of the distribution list"
"12/04/2013 15:00:53" " Checking conditions: No PW defined"
"12/04/2013 15:00:53" " -> result = false : recipient will be deleted"
"12/04/2013 15:00:53" " --> Recipient will be deleted."
"12/04/2013 15:00:53" " Changing recipients"
"12/04/2013 15:00:53" " Recipient listserv@mydomain has been deleted"

Any help appreciated.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-04-12 16:24

Hello.


I made some documentation here:
http://www.sspxusa.org/goodies/hMailSer ... manual.htm

But here is the download link:
http://www.sspxusa.org/goodies/hMailSer ... Server.zip

I don't make any guarantees, but I am using this in production.

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

Re: Distribution list enhancement

Post by simonjshaw » 2013-04-12 16:33

Hi Br Gabriel
I'm afraid that link gives me a server-specific 404 not found error

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-04-12 16:46

I'm sorry; I had misnamed the file; try it again.

I assume the documentation link works, however.

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

Re: Distribution list enhancement

Post by simonjshaw » 2013-04-12 18:22

Got it downloaded, thank you. I assume no-one else has used the published link, so I might be on my own with this version.

Still not very sure how to use it - I'm afraid I don't find the documentation very clear on setting up fist list.
Since it doesn't mention it, am I to understand I don't need to have a listserv@domain user? Do I send subscribe commands to the list itself?

And I'm getting some VBS errors. Variables not defined:

"ERROR" 1316 "2013-04-12 17:04:06.562" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A01F4 - Description: Variable is undefined: 'configfileextension' - Line: 751 Column: 2 - Code: (null)"

I put a public constant in for that, value ".hms", then I got...

"ERROR" 1316 "2013-04-12 17:08:50.827" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A01F4 - Description: Variable is undefined: 'serveradmin' - Line: 911 Column: 18 - Code: (null)"

So I'm thinking perhaps I'll just give up on this.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-04-12 19:01

Did you read through this page:
http://www.sspxusa.org/goodies/hMailSer ... ist_9.html

Point Number 5 says,

5.Set the name of your list-level settings file. Remember the name of the distribution list you created? Go into the config\bobsdomain.com directory, find the file called mylist_at_mydomain_com.hms and rename it. Now, you have to get this right, or it won't work. (There are some directions for this.) So now you should have renamed the sample file to bobslist_at_bobsdomain_com.hms.

In this version, I changed all the extensions from .txt to .hms in order to facilitate automatic syntax colouration in notepad++. But if your global settings are set to .txt, then you won't have to change the file extension.

If you want to get this working for you, you will have to either read all of the documentation and understand what is happening, or you can download the original script and try to figure it out the way I did.

What you can't do: plop the script into hMailServer and expect it to "just work".
Sorry, it's too complicated for that.
You have to do a certain amount of configuration. That's why I made the documentation.

If you are already willing to give up, I say that is probably a good idea.

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

Re: Distribution list enhancement

Post by mattg » 2013-04-13 01:00

brother.gabriel wrote:If you are already willing to give up, I say that is probably a good idea.
+1
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: Distribution list enhancement

Post by simonjshaw » 2013-04-13 15:58

Okay, I probably shouldn't give up yet, I'd just had a long and frustrating Friday, but I think it's slightly unfair to say "read the manual", when in fact I have done that, I have implemented what I've read, but am still experiencing an error due to an undeclared/unassigned variable - not because my settings haven't been configured.

I'd like to get it working, and would appreciate some specific help, if you have the time.

Specifically, where should the variable "serveradmin" be declared, and where should it's value be set?
I cannot see a declaration. "Option explicit" is set, which will then cause the error.
Would you mind having a look at this point for me and tell me where I'm going wrong?
I could just declare and assign it at the top of the script like I did for the config file suffix issue.

By the way, I only have a list-level settings file. It is correctly named and is being picked up.
I have an empty (apart from a "this is a sample" comment) global config.hms as per the downloded package.

If you haven't time to help then I do understand.

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

Re: Distribution list enhancement

Post by simonjshaw » 2013-04-13 16:09

I got it working! I added these two lines to the script:

Public Const configfileextension = ".hms"
Public Const serveradmin = "me@mydomain"

If this addition is needed in the standard script I hope this has helped.
If not, then I would appreciate knowing how I should have solved this issue?

Thanks to all those who worked on this.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-04-13 17:15

Simon, if you were missing those two variables, it was my fault.

I'm glad you didn't give up - you got me on that one. I was using my production server as a dev server and copying out the settings for the distribution, and I guess I missed copying over those two constants.

I took a look through the script and didn't find anything else missing.

So I've updated the script.

Noone else has ever said anything, so I suppose you are the only person to download the new script.

Thanks for finding it! Sorry for the trouble.

Now, I do have another unpublished update. But I have a "changes" section in the documentation that will say what was done and what needs to be done to a currently running setup in order to use the newer version. I'll post back here once I get it together.

Toast_r
New user
New user
Posts: 3
Joined: 2013-05-05 12:24
Location: Germany

Re: Distribution list enhancement

Post by Toast_r » 2013-05-05 13:13

Hi Gabriel,
thank you for your work on the listserver, I think you have done a great on it.
I installed it yesterday and its running.
But I noticed one issue whith html messages.
The html footer is not appended at the end of the message, but is inserted in message near by the beginning.
There are not a lot messages since I installed it yesterday, but this can be seen on all html messages there are so far, which were all sent by the same user.

Here is an example message received from the listserver:

Code: Select all

Return-Path: Admin@mydomain.com
Delivered-To: list@mydomain.com
Received: from mail-vb0-f43.google.com ([209.85.212.43]) by mail.mydomain.com ; Sun,
 5 May 2013 11:58:12 +0200
Received: by mail-vb0-f43.google.com with SMTP id p14so2355681vbm.30 for
 <list@mydomain.com>; Sun, 05 May 2013 02:58:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113;
 h=mime-version:x-received:date:message-id:subject:from:to :content-type;
 bh=yhxVNVA1XpUYJHu1WFhDhYB5qhcRv0EGBvjp94nXFP8=;
 b=VTOowb//pbpEJ9HqZnfZeJDIZ6ESaGSTtPswjf3sFdZlf29IYCKScPmTYyoIl3T27w
 4lgpfqj9P27lU9ZnL/ovd5O26wDlK7AVa2TQfUV5Ml1Ao/SadbzBnxmqoL4XSjnFMk1i
 C58029duOQQnvDLvc/9D25zVHyyIZVTmZvIiX4V582tYeO4w7hAFCHZ+kBckis/AUbWV
 xHxaOKM5zeoQlGvxpxM7Ggzgq6j1pRXVzYqGEckQO6JVxIBTBo2ADxXIzvjIA2IgJ5VX
 pEOkJ+xgZyf80V5dwD+huIMJphVAJadLBXG85eT1U/BtWrkAsIogdOidEMEJjAnMgTT/
 1ZVQ==
MIME-Version: 1.0
X-Received: by 10.52.232.165 with SMTP id tp5mr3964611vdc.120.1367747890119; Sun, 05 May
 2013 02:58:10 -0700 (PDT)
Received: by 10.58.178.175 with HTTP; Sun, 5 May 2013 02:58:10 -0700 (PDT)
Date: Sun, 5 May 2013 11:58:10 +0200
Message-ID: <CAFcYn_F+qfVEeCFNg-RDYLFiFue7urY12RYodkU5Uk0zoiOM5g@mail.gmail.com>
Subject: Blah Blah
From: User <user@googlemail.com>
To: list@mydomain.com
Content-Type: multipart/alternative; boundary=089e0122f4802209dc04dbf59f17
oclient: 
Sender: list@mydomain.com
Reply-To: list@mydomain.com
Return-Path: Admin@mydomain.com

--089e0122f4802209dc04dbf59f17
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Blah Blah Blah
Blah Blah Blah

--=20
Mail was sent via list@mydomain.com.

--089e0122f4802209dc04dbf59f17
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div>Blah Blah Blah<br><br><p>Mail was sent via list@mydomain.com.</p>
</div>Blah Blah Blah<br>
</div>Blah Blah Blah<br><br>Blah Blah Blah<br><br></div>Blah Blah Blah</div>

--089e0122f4802209dc04dbf59f17--
Here is the config file for the list:

Code: Select all

admin=Admin@mydomain.com
operator=or
todo=redirect
pw_enclosure=#
pw=
allowmembers=true
allowaddresses=

addsenderheader=list
addreplytoheader=list
addreturnpathheader=%admin%
smtpmailfrom=%serveradmin%
allowed_attachments=
disallowed_attachments=
allowed_attachment_size=
allowed_attachments_total_size=
subjectprefix=
failure_notification=true
failure_notification_subject=Delivery failed
failure_notification_file=failure_notification.txt
success_notification=false
success_notification_subject=Successful delivery
success_notification_file=success_notification.txt
header_file=
footer_file=footer.txt
header_file_html=
footer_file_html=footer.html
attach_recipients_to_footer=false
attach_recipients_delimiter=; 
attach_recipients_html=<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>%recipients%</span></font></p>
email_subscription=true
email_subscription_admin_notification=true
email_subscription_allowed_cmds=
help
subscribe
unsubscribe
list
#subscribeaddress
#unsubscribeaddress
#subscribelist
#unsubscribelist

email_subscription_success_notification=true
email_subscription_failure_notification=true

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-05-05 17:37

Hi, Mr. Toast,

Hmmm...

Now that I look at it, I think my messages have the same problem.

I'll have to look at that.

If anyone has a clue, I'm all ears.

Toast_r
New user
New user
Posts: 3
Joined: 2013-05-05 12:24
Location: Germany

Re: Distribution list enhancement

Post by Toast_r » 2013-05-05 21:53

I also have another problem, which is much more annoying:
The lock file often is not deleted and then messages in the queue are not processed.
My error log is full of these:
"ERROR" 5424 "2013-05-05 20:10:32.093" "Script Error: Source: runtime error in Microsoft VBScript - Error: 800A0005 - Description: Invalid procedure call or argument - Line: 1698 Column: 3 - Code: (null)"

"ERROR" 4984 "2013-05-05 17:42:15.406" "Severity: 3 (Medium), Code: HM4226, Source: SMTPDeliverer::_DeliverToExternalAccounts, Description: Could not deliver message; Recipient address missing."

I don't know if these are related to each other.

For the first one, I marked line 1698:

Code: Select all

Sub write_log(txt)
	Const ForReading = 1, ForWriting = 2, ForAppending = 8
	Dim fs
	Dim f
	Dim fn
	Dim fnl
	Dim tmp 
	
	If write_log_active then
		Set fs = CreateObject("scripting.filesystemobject")
		
		fn = logspath & "hmailserver_event_" & get_date & ".log"
		fnl = logspath & "hmailserver_event_" & get_date & ".lock"
		
		If fs.FileExists(fnl) then
		    Dim i
			For i = 0 To 25
				log_delay
				If Not fs.FileExists(fnl) Then
					i = 10000
				End If
			next
		End If
		
		If Not fs.FileExists(fnl) then
			Set f = fs.opentextfile(fnl, ForWriting, true)
			f.Write("")
			f.Close
			Set f = fs.opentextfile(fn, ForAppending, true)
			'It would be cleaner without the quotes, but they seem to be used as discovery tokens in SMTP_log_position
			tmp = """" & FormatDateTime(Date + time,0) & """" & Chr(9) & """" & txt & """" & nl	
			'tmp = FormatDateTime(Date + time,0) & "   " & txt & nl
LINE 1698	f.Write(tmp)
			f.Close
			fs.DeleteFile(fnl)
		End If
	End if
End Sub

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-05-06 01:05

The log problem - I think I know the answer to that one.

I hMailServer Administrator, under Settings, go to "Logging" and make sure that "Keep Files Open" is unchecked. If it is checked, it locks the log file.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-05-06 01:07

Also, are you using hMailServer version 4? My fixes messed up the backward compability. I am using version 5 with this script and never get any of the errors you are reporting (that doesn't mean much, however :cry: ).

Toast_r
New user
New user
Posts: 3
Joined: 2013-05-05 12:24
Location: Germany

Re: Distribution list enhancement

Post by Toast_r » 2013-05-06 08:12

Hi Gabriel,
thank you, but there must be something else causing it.
The keep files open switch was already deactivated.
I am using hMailserver 5.5.3-B1879 with MSSQL CE.
Since my last post there was not much traffic on the list and no errors occured.
But I don't think the problems disappeared themselves, so I'll have to observe it ...

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-05-06 15:51

Mr. Toast,

Okay. If you find anything out, let me know and I'll be happy to update the script and/or documentation.

Karnage
New user
New user
Posts: 14
Joined: 2013-08-08 01:23

Re: Distribution list enhancement

Post by Karnage » 2013-08-08 01:34

Sorry if this is a noob question but will this script do the following -

1: Allow me to change the " reply to", to the list address, rather than the senders address, so when someone on the list presses reply it will automatically reply to the list address rather than the senders address?

2: Add the list name to the Subject so the subject would be changed to something like this - "
  • original subject"

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-08-08 02:15

You can do just about anything. Have you taken a look at the documentation for it? Take a look at the "Features" section.

Karnage
New user
New user
Posts: 14
Joined: 2013-08-08 01:23

Re: Distribution list enhancement

Post by Karnage » 2013-08-08 02:29

brother.gabriel wrote:You can do just about anything. Have you taken a look at the documentation for it? Take a look at the "Features" section.
Yes I looked at the features section & i'm pretty sure you can change the reply to header but wasn't sure about the subject.
I just wanted to be sure before I jumped in and started experimenting, as it could be steep leaning curve for me, not know anything about scripting.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-08-08 02:58

Well, it's just a vbs script, so you can always change it to suit your fancy. You can make it do anything you want.

If you find any significant improvements or fix any bugs, post back here so we can update the script (I've sort of put myself in charge of it since I wrote the documentation pages).

Karnage
New user
New user
Posts: 14
Joined: 2013-08-08 01:23

Re: Distribution list enhancement

Post by Karnage » 2013-08-08 03:14

brother.gabriel wrote:Well, it's just a vbs script, so you can always change it to suit your fancy. You can make it do anything you want.

If you find any significant improvements or fix any bugs, post back here so we can update the script (I've sort of put myself in charge of it since I wrote the documentation pages).
Thanks for your reply.
Unfortunately I don't really know anything about scripting or VBS. I was hoping it was as simple as downloading the script and seting the "list name" for the Subject field & seting the "reply to" field to the list address.
It looks like its not that simple & I may be getting in way over my head.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-08-08 04:48

Weeeelll, no, it's not really thaaaat simple... Read the section in the docs for "installation" before you begin. But before you can install the script, you have to install hMailServer and get it running, too.

Chances are, however, that if you get hMailServer working, you might have what it takes to get the script running for you.

The script works. It does what it's supposed to, but it ain't plug-n-play.

If you don't really want a list server, but just to change the reply address, this might be overkill.

Karnage
New user
New user
Posts: 14
Joined: 2013-08-08 01:23

Re: Distribution list enhancement

Post by Karnage » 2013-08-08 05:31

I have been running mail servers and domain & web hosting for years and switched over to hMailServer about 6 months ago with 8 domains & about 50 email addresses. I'm very happy with hMailServer, it does everything I need except the 2 additions to the distribution list i'd like.
I have installed the script but not quite sure where to start. Any pointers on where in the script I would make these 2 changes would be greatly appreciated. Once I know where to start, I can experiment until I get it working.

User avatar
brother.gabriel
Normal user
Normal user
Posts: 139
Joined: 2012-03-29 17:25
Location: Kansas City
Contact:

Re: Distribution list enhancement

Post by brother.gabriel » 2013-08-08 07:10

Well, I'd suggest looking over the docs at "installation and setup" and "how to set up your first list". Really, everything should be there. After you've read that and tried it, I'll be happy to help.

But you've got to read it. I wrote it so you can read it. It's a lot, but there are a lot of pictures. The help file comes as a chm file when you download the package, so you don't have to use the online version (they are the same anyway).

Karnage
New user
New user
Posts: 14
Joined: 2013-08-08 01:23

Re: Distribution list enhancement

Post by Karnage » 2013-08-08 07:39

brother.gabriel wrote:Well, I'd suggest looking over the docs at "installation and setup" and "how to set up your first list". Really, everything should be there. After you've read that and tried it, I'll be happy to help.

But you've got to read it. I wrote it so you can read it. It's a lot, but there are a lot of pictures. The help file comes as a chm file when you download the package, so you don't have to use the online version (they are the same anyway).
Oh I am so sorry. I have been looking at the script & help files in the first post only. I did not see the manual you posted later.
This is very well written and I think there is more that enough info there for me to get started. Thanks for your help & efforts in producing the manual.

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2013-10-30 10:35

Hello

This script is exactly what I was looking for. Thanks for this! :D

A small idea: A password for some lists commands (especially: list, subscribelist, unsubscribelist, subscribeaddress, unsubscribeaddress). Then only admins can use list commands in public lists.

Greetings from switzerland

Peter

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

non member mail delivered

Post by Colossus999 » 2013-10-30 14:56

Houston, we have a problem!

I installed the script (thanks for the documentation) an set up a test list with 4 members for a closed mailing group, with a password for external users and all list commands on (for testing only).

- List commands works
- Mails from Members works
- Mails from non-members with password works

BUT: Mails from non-members WITHOUT password are delivered to! No failure message!

In the Log i see this:

Code: Select all

"10/30/2013 1:31:11 PM"	"     -->Ooooo! Looky! : PW wrong"
"10/30/2013 1:31:11 PM"	"          This is a distribution list"
"10/30/2013 1:31:11 PM"	"          Not a member of the distribution list"
"10/30/2013 1:31:11 PM"	"          Checking conditions: Operator or"
"10/30/2013 1:31:11 PM"	"          -->result = false : recipient will be deleted"
"10/30/2013 1:31:13 PM"	"------------------------- OnDeliverMessage Event -------------------------"
"10/30/2013 1:31:13 PM"	"     Message Delivered"



here the complete log from my last test (with some xxxx to replace private information):

Code: Select all

"10/30/2013 1:31:11 PM"	"------------------------- OnAcceptMessage Event -------------------------"
"10/30/2013 1:31:11 PM"	"     Adding oclient header: XXX.XXX.131.239##25"
"10/30/2013 1:31:11 PM"	"------------------------- OnDeliveryStart Event -------------------------"
"10/30/2013 1:31:11 PM"	"~Mail FromAddress: Peter.XXXX@XXXX.ch"
"10/30/2013 1:31:11 PM"	"~Mail From: Zumstein Peter <Peter.XXXX@XXXX.ch>"
"10/30/2013 1:31:11 PM"	"~Mail To: "'test@XXXX.ch'" <test@XXXX.ch>"
"10/30/2013 1:31:11 PM"	"~Subject: Ok, lets try"
"10/30/2013 1:31:11 PM"	"~-->Starting mail configuration check"
"10/30/2013 1:31:11 PM"	"     Recipient: test@XXXX.ch"
"10/30/2013 1:31:11 PM"	"~-->Reading config file: C:\Program Files (x86)\hMailServer\config\XXXX.ch\test_at_XXXX_ch.hms"
"10/30/2013 1:31:11 PM"	"          admin=peter@XXXX.org"
"10/30/2013 1:31:11 PM"	"          operator=or"
"10/30/2013 1:31:11 PM"	"          todo=delete"
"10/30/2013 1:31:11 PM"	"          pw_enclosure=#"
"10/30/2013 1:31:11 PM"	"          pw=XXXX"
"10/30/2013 1:31:11 PM"	"          allowmembers=true"
"10/30/2013 1:31:11 PM"	"          addsenderheader=list"
"10/30/2013 1:31:11 PM"	"          addreplytoheader=%mailfrom%"
"10/30/2013 1:31:11 PM"	"          addreturnpathheader=%admin%"
"10/30/2013 1:31:11 PM"	"          smtpmailfrom=%serveradmin%"
"10/30/2013 1:31:11 PM"	"          disallowed_attachments=#exe#bat#com#msi#scr"
"10/30/2013 1:31:11 PM"	"          subjectprefix=%address%: "
"10/30/2013 1:31:11 PM"	"          failure_notification=true"
"10/30/2013 1:31:11 PM"	"          failure_notification_subject=Delivery Failure"
"10/30/2013 1:31:11 PM"	"          failure_notification_file=failure_notification.txt"
"10/30/2013 1:31:11 PM"	"          success_notification=true"
"10/30/2013 1:31:11 PM"	"          success_notification_subject=Successful delivery"
"10/30/2013 1:31:11 PM"	"          success_notification_file=success_notification.txt"
"10/30/2013 1:31:11 PM"	"          header_file=header.txt"
"10/30/2013 1:31:11 PM"	"          footer_file=footer.txt"
"10/30/2013 1:31:11 PM"	"          header_file_html=header.html"
"10/30/2013 1:31:11 PM"	"          footer_file_html=footer.html"
"10/30/2013 1:31:11 PM"	"          attach_recipients_to_footer=true"
"10/30/2013 1:31:11 PM"	"          attach_recipients_delimiter=; "
"10/30/2013 1:31:11 PM"	"          attach_recipients_html=<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>%recipients%</span></font></p>"
"10/30/2013 1:31:11 PM"	"          email_subscription=true"
"10/30/2013 1:31:11 PM"	"          email_subscription_admin_notification=true"
"10/30/2013 1:31:11 PM"	"          email_subscription_allowed_cmds=help#subscribe#unsubscribe#list#subscribeaddress#unsubscribeaddress#subscribelist#unsubscribelist"
"10/30/2013 1:31:11 PM"	"          email_subscription_success_notification=true"
"10/30/2013 1:31:11 PM"	"          email_subscription_failure_notification=true"
"10/30/2013 1:31:11 PM"	"     Subscription via email activated."
"10/30/2013 1:31:11 PM"	"     CONSIDERING SUBSCRIPTIONS COMMANDS"
"10/30/2013 1:31:11 PM"	"      Email subject does not contain a valid command."
"10/30/2013 1:31:11 PM"	"     Checking recipient: test@XXXX.ch"
"10/30/2013 1:31:11 PM"	"     -->Ooooo! Looky! : PW wrong"
"10/30/2013 1:31:11 PM"	"          This is a distribution list"
"10/30/2013 1:31:11 PM"	"          Not a member of the distribution list"
"10/30/2013 1:31:11 PM"	"          Checking conditions: Operator or"
"10/30/2013 1:31:11 PM"	"          -->result = false : recipient will be deleted"
"10/30/2013 1:31:13 PM"	"------------------------- OnDeliverMessage Event -------------------------"
"10/30/2013 1:31:13 PM"	"     Message Delivered"

In the Error log is a new entry:

Code: Select all

"ERROR"	2668	"2013-10-30 13:31:11.909"	"Script Error: Source: Microsoft VBScript runtime error - Error: 800A003E - Description: Input past end of file - Line: 2096 Column: 2 - Code: (null)"
I'am sure its my fault :oops: , but where is the problem? :?:

Thanks for help.

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2013-10-30 16:41

Ok, found the problem: My domainposter.txt was empty. Adding a single adress solves the problem. Now non member mails and notifications works as expected.

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2013-10-30 17:43

Ok, new problem

I set the parameter "todo" to "redirect and test it with a non member email. Here is the log:

Code: Select all

"10/30/2013 3:49:54 PM"	"------------------------- OnAcceptMessage Event -------------------------"
"10/30/2013 3:49:54 PM"	"     Adding oclient header: XXX.209.131.XXX##25"
"10/30/2013 3:49:54 PM"	"------------------------- OnDeliveryStart Event -------------------------"
"10/30/2013 3:49:54 PM"	"~Mail FromAddress: Peter.XXXX@XXXX.ch"
"10/30/2013 3:49:54 PM"	"~Mail From: Zumstein Peter <Peter.XXXX@XXXX.ch>"
"10/30/2013 3:49:54 PM"	"~Mail To: "test@XXXX.ch" <test@XXXX.ch>"
"10/30/2013 3:49:54 PM"	"~Subject: Test Redirect"
"10/30/2013 3:49:54 PM"	"~-->Starting mail configuration check"
"10/30/2013 3:49:54 PM"	"     Recipient: test@XXXX.ch"
"10/30/2013 3:49:54 PM"	"~-->Reading config file: C:\Program Files (x86)\hMailServer\config\sjmk.ch\test_at_XXXX_ch.hms"
"10/30/2013 3:49:54 PM"	"          admin=peter@XXXX.org"
"10/30/2013 3:49:54 PM"	"          operator=or"
"10/30/2013 3:49:54 PM"	"          todo=redirect"
"10/30/2013 3:49:54 PM"	"          pw_enclosure=#"
"10/30/2013 3:49:54 PM"	"          pw=XXXX"
"10/30/2013 3:49:54 PM"	"          allowmembers=true"
"10/30/2013 3:49:54 PM"	"          addsenderheader=list"
"10/30/2013 3:49:54 PM"	"          addreplytoheader=%mailfrom%"
"10/30/2013 3:49:54 PM"	"          addreturnpathheader=%admin%"
"10/30/2013 3:49:54 PM"	"          smtpmailfrom=%serveradmin%"
"10/30/2013 3:49:54 PM"	"          disallowed_attachments=#exe#bat#com#msi#scr"
"10/30/2013 3:49:54 PM"	"          subjectprefix=%address%: "
"10/30/2013 3:49:54 PM"	"          failure_notification=true"
"10/30/2013 3:49:54 PM"	"          failure_notification_subject=Delivery Failure"
"10/30/2013 3:49:54 PM"	"          failure_notification_file=failure_notification.txt"
"10/30/2013 3:49:54 PM"	"          success_notification=true"
"10/30/2013 3:49:54 PM"	"          success_notification_subject=Successful delivery"
"10/30/2013 3:49:54 PM"	"          success_notification_file=success_notification.txt"
"10/30/2013 3:49:54 PM"	"          header_file=header.txt"
"10/30/2013 3:49:54 PM"	"          footer_file=footer.txt"
"10/30/2013 3:49:54 PM"	"          header_file_html=header.html"
"10/30/2013 3:49:54 PM"	"          footer_file_html=footer.html"
"10/30/2013 3:49:54 PM"	"          attach_recipients_to_footer=true"
"10/30/2013 3:49:54 PM"	"          attach_recipients_delimiter=; "
"10/30/2013 3:49:54 PM"	"          attach_recipients_html=<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>%recipients%</span></font></p>"
"10/30/2013 3:49:54 PM"	"          email_subscription=true"
"10/30/2013 3:49:54 PM"	"          email_subscription_admin_notification=true"
"10/30/2013 3:49:54 PM"	"          email_subscription_allowed_cmds=help#subscribe#unsubscribe#list#subscribeaddress#unsubscribeaddress#subscribelist#unsubscribelist"
"10/30/2013 3:49:54 PM"	"          email_subscription_success_notification=true"
"10/30/2013 3:49:54 PM"	"          email_subscription_failure_notification=true"
"10/30/2013 3:49:54 PM"	"     Subscription via email activated."
"10/30/2013 3:49:54 PM"	"     CONSIDERING SUBSCRIPTIONS COMMANDS"
"10/30/2013 3:49:54 PM"	"      Email subject does not contain a valid command."
"10/30/2013 3:49:54 PM"	"     Checking recipient: test@XXXX.ch"
"10/30/2013 3:49:54 PM"	"     -->Ooooo! Looky! : PW wrong"
"10/30/2013 3:49:54 PM"	"          This is a distribution list"
"10/30/2013 3:49:54 PM"	"          Not a member of the distribution list"
"10/30/2013 3:49:54 PM"	"          Checking conditions: Operator or"
"10/30/2013 3:49:54 PM"	"          -->result = false : recipient will be deleted"
"10/30/2013 3:49:54 PM"	"     Global + Domain Posters are:info@xxxx.ch#info@xxxx.ch"
"10/30/2013 3:49:54 PM"	"          -->Recipient will be deleted."
"10/30/2013 3:49:54 PM"	"     Changing recipients"
"10/30/2013 3:49:54 PM"	"     Recipient test@XXXX.ch has been redirected to admin"
"10/30/2013 3:49:54 PM"	"     Adding admin email address."
The "admin" parameter contains my email address and the log says "redirected". But I get no mail. There are no errors in the error log.

hMailServer log of this action:

Code: Select all

"TCPIP"	3440	"2013-10-30 15:49:53.156"	"TCP - xxx.209.131.xxxconnected to xxx.228.112.xxx:25."
"DEBUG"	3440	"2013-10-30 15:49:53.159"	"Creating session 87"
"SMTPD"	3440	87	"2013-10-30 15:49:53.159"	"xxx.209.131.xxx"	"SENT: 220 mail.zumsteinweb.ch ESMTP"
"SMTPD"	3440	87	"2013-10-30 15:49:53.164"	"xxx.209.131.xxx"	"RECEIVED: EHLO esa1.xxxx.ch"
"SMTPD"	3440	87	"2013-10-30 15:49:53.165"	"xxx.209.131.xxx"	"SENT: 250-mail.xxxxx.ch[nl]250-SIZE 20480000[nl]250 AUTH LOGIN"
"SMTPD"	3416	87	"2013-10-30 15:49:53.172"	"xxx.209.131.xxx"	"RECEIVED: MAIL FROM:<Peter.xxxx@xxxx.ch> SIZE=7849"
"DEBUG"	3416	"2013-10-30 15:49:53.177"	"Spam test: SpamTestHeloHost, Score: 0"
"DEBUG"	3416	"2013-10-30 15:49:53.177"	"Spam test: SpamTestMXRecords, Score: 0"
"DEBUG"	3416	"2013-10-30 15:49:53.180"	"Spam test: SpamTestSPF, Score: 0"
"DEBUG"	3416	"2013-10-30 15:49:53.181"	"Total spam score: 0"
"SMTPD"	3416	87	"2013-10-30 15:49:53.184"	"xxx.209.131.xxx"	"SENT: 250 OK"
"SMTPD"	3408	87	"2013-10-30 15:49:53.196"	"xxx.209.131.xxx"	"RECEIVED: RCPT TO:<test@xxxx.ch>"
"DEBUG"	3408	"2013-10-30 15:49:53.203"	"DistributionList::LMPublic"
"SMTPD"	3408	0	"2013-10-30 15:49:53.232"	"TCP"	"DNS - MX Lookup: xxxx.ch"
"SMTPD"	3408	0	"2013-10-30 15:49:53.235"	"TCP"	"DNS - MX Result: 3 IP addresses were found."
"DEBUG"	3408	"2013-10-30 15:49:53.235"	"Mail coming from A or MX record. Skipping grey listing."
"SMTPD"	3408	87	"2013-10-30 15:49:53.243"	"xxx.209.131.xxx"	"SENT: 250 OK"
"SMTPD"	3408	87	"2013-10-30 15:49:53.248"	"xxx.209.131.xxx"	"RECEIVED: DATA"
"SMTPD"	3408	87	"2013-10-30 15:49:53.249"	"xxx.209.131.xxx"	"SENT: 354 OK, send."
"DEBUG"	3228	"2013-10-30 15:49:54.255"	"Spam test: SpamTestSpamAssassin, Score: 0"
"DEBUG"	3228	"2013-10-30 15:49:54.256"	"Total spam score: 0"
"DEBUG"	3228	"2013-10-30 15:49:54.256"	"ScriptServer:FireEvent"
"DEBUG"	3228	"2013-10-30 15:49:54.268"	"ScriptServer:~FireEvent"
"DEBUG"	3228	"2013-10-30 15:49:54.268"	"Saving message: {105F8C82-B9B1-4487-AFCB-D8E26DE7295F}.eml"
"DEBUG"	3228	"2013-10-30 15:49:54.284"	"Requesting SMTPDeliveryManager to start message delivery"
"SMTPD"	3228	87	"2013-10-30 15:49:54.285"	"xxx.209.131.xxx"	"SENT: 250 Queued (1.016 seconds)"
"DEBUG"	3336	"2013-10-30 15:49:54.290"	"Delivering message..."
"DEBUG"	3336	"2013-10-30 15:49:54.290"	"ScriptServer:FireEvent"
"DEBUG"	3336	"2013-10-30 15:49:54.613"	"ScriptServer:~FireEvent"
"DEBUG"	3336	"2013-10-30 15:49:54.614"	"Deleting message"
"DEBUG"	3336	"2013-10-30 15:49:54.622"	"Deleting message file."
"SMTPD"	3432	87	"2013-10-30 15:49:59.304"	"xxx.209.131.xxx"	"RECEIVED: QUIT"
"SMTPD"	3432	87	"2013-10-30 15:49:59.304"	"xxx.209.131.xxx"	"SENT: 221 goodbye"
"DEBUG"	3432	"2013-10-30 15:49:59.305"	"Closing TCP/IP socket"
"DEBUG"	3432	"2013-10-30 15:49:59.305"	"Ending session 87"

Any ideas?

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

Re: Distribution list enhancement

Post by mattg » 2013-10-31 01:36

Colossus999 wrote:The "admin" parameter contains my email address and the log says "redirected". But I get no mail. There are no errors in the error log.

hMailServer log of this action:
Which is your admin address?

is it a locally hosted account, or is it hosted elsewhere?
Look for SMTPC line following this. SMTPD is receiving, SMTPC is sending
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2013-10-31 05:07

mattg wrote:Which is your admin address?

is it a locally hosted account, or is it hosted elsewhere?
Look for SMTPC line following this. SMTPD is receiving, SMTPC is sending
My normal address is hosted locally (but not the same domain as the list). Tested a external account too. Same result.

I can't find any SMTPC log entry that fits the to the redirect.

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2013-11-01 19:13

Ok, problem identified!

File: "EventHandlers.vbs"

Code: Select all

324.				dim thisadmin	'fetch the admin setting from the config file
325.				thisadmin = get_config_string(mailto, "admin")
326.				thisadmin = ReplaceTokens(temp, mailto, mailfrom)	
In line 326 ReplaceTokens returns an empty string. Variable "temp" has no value and the value in "thisadmin" is cleared. So the message receives no new email address for the redirect.

:idea: Replace "temp" with "thisadmin". It works!

Code: Select all

326.				thisadmin = ReplaceTokens(thisadmin, mailto, mailfrom)	

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2014-02-12 21:48

Hello again

Have new problem: Digital signed Mails!

If the script is turned on, the signature is corrupted in digitally signed e-mails. Error message after sending and receiving of email: "Invalid signature. The message may have been altered". After the script is turned off, signatures are sent valid again.

The mail account used is not a list. There is also no hms config file for this account. The email should therefore not be touched or changed. Is there a config option which ensures that the messages are left unchanged in such a non-configured account?

Thanks for helping.

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

Re: Distribution list enhancement

Post by mattg » 2014-02-13 00:39

Doesn't this script add header(s), and change the from?

That is changing the message as far as digital signatures is concerned.
I doubt that you could change a message, and maintain a digital signature. (I mean, that's the point of digital signatures, right?)
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2014-02-13 07:51

mattg wrote:Doesn't this script add header(s), and change the from?

That is changing the message as far as digital signatures is concerned.
I doubt that you could change a message, and maintain a digital signature. (I mean, that's the point of digital signatures, right?)
Yes, that is the meaning of the script. But ONLY for accounts that are configured as a list. All other messages must not be changed!

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Distribution list enhancement

Post by Bill48105 » 2014-02-13 08:00

Colossus999 wrote:
mattg wrote:Doesn't this script add header(s), and change the from?

That is changing the message as far as digital signatures is concerned.
I doubt that you could change a message, and maintain a digital signature. (I mean, that's the point of digital signatures, right?)
Yes, that is the meaning of the script. But ONLY for accounts that are configured as a list. All other messages must not be changed!
This script only adds the oclient header vcalue if the destination is a list:

Code: Select all

If is_local_list(oMessage.Recipients(i).OriginalAddress) then add_client_info oClient, oMessage
If the email is to multiple recipients they all share the same email "oMessage". If you need something else modify the script to make COPIES of the message & only add headers to the list copy.
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2014-02-13 09:09

Sorry, but there must be other changes on my emails.

If I send a signed email from my account (not a list) with script activated, directly (not via a list) to an external (not on my hMailServer) or internal (on my hMailServer, but not a list) destination address, then the signature is corrupted. The same email with scripts disabled and the signature remains intact.

This means that the script changed outgoing mails, right?

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2014-02-13 10:53

Bill48105 wrote:This script only adds the oclient header vcalue if the destination is a list:

Code: Select all

If is_local_list(oMessage.Recipients(i).OriginalAddress) then add_client_info oClient, oMessage
If the email is to multiple recipients they all share the same email "oMessage". If you need something else modify the script to make COPIES of the message & only add headers to the list copy.
Ahhhhhh..... My fault :roll: . Now i understand :idea: . Will test this.

Thanks for your help. Greetings from switzerland.

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Distribution list enhancement

Post by Bill48105 » 2014-02-13 16:54

Colossus999 wrote:
Bill48105 wrote:This script only adds the oclient header vcalue if the destination is a list:

Code: Select all

If is_local_list(oMessage.Recipients(i).OriginalAddress) then add_client_info oClient, oMessage
If the email is to multiple recipients they all share the same email "oMessage". If you need something else modify the script to make COPIES of the message & only add headers to the list copy.
Ahhhhhh..... My fault :roll: . Now i understand :idea: . Will test this.

Thanks for your help. Greetings from switzerland.
Right no worries. Not debating if the script is changing or if it has an issue (even if specific to you) but yeah check out where the header is added to see if that gets you anywhere. For all I know I changed my version here it's been so long but I don't see the list headers in my normal emails.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

User avatar
Colossus999
New user
New user
Posts: 11
Joined: 2013-10-30 10:21

Re: Distribution list enhancement

Post by Colossus999 » 2014-02-14 22:36

Bill48105 wrote:

Code: Select all

If is_local_list(oMessage.Recipients(i).OriginalAddress) then add_client_info oClient, oMessage
This can't work. "i" isn't defined at this point and "oMessage.Recipients(i).OriginalAddress" requires For...Next if more than 1 recipient exists.

My solution change a mail only if at least one of the recipients is a list. In this way, signed mails with a valid signature can be sent as long as none of the recipients is a list.

Code: Select all

Sub OnAcceptMessage(oClient, oMessage)
	write_log(d1 & " OnAcceptMessage Event " & d1)
	Set obApp = CreateObject("hMailServer.Application")
	Call obApp.Authenticate(user, pw)

	Dim ListFlag
	Dim ListCheck
	Dim ListCount
	ListFlag = false
	For ListCount = 0 To (oMessage.Recipients.count - 1)
		ListCheck = is_local_list(oMessage.Recipients(ListCount).OriginalAddress)
		If ListCheck Then ListFlag = true
		write_log ("Target   : " & oMessage.Recipients(ListCount).OriginalAddress)
		write_log ("Is list? : " & ListCheck )
		write_log ("----------------------------------------")
	Next
	If ListFlag Then
		write_log ("Recipents containing list(s).")
		write_log ("Edit message before sending.")
		add_client_info oClient, oMessage 	'prepare_mailconfiguration oClient, oMessage
	Else
		write_log ("Recipents containing no list(s).")
		write_log ("Keep message untouched.")
	End If
End Sub

Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Distribution list enhancement

Post by Bill48105 » 2014-02-15 02:04

Colossus999 wrote:
Bill48105 wrote:

Code: Select all

If is_local_list(oMessage.Recipients(i).OriginalAddress) then add_client_info oClient, oMessage
This can't work. "i" isn't defined at this point and "oMessage.Recipients(i).OriginalAddress" requires For...Next if more than 1 recipient exists.

My solution change a mail only if at least one of the recipients is a list. In this way, signed mails with a valid signature can be sent as long as none of the recipients is a list.

Code: Select all

Sub OnAcceptMessage(oClient, oMessage)
	write_log(d1 & " OnAcceptMessage Event " & d1)
	Set obApp = CreateObject("hMailServer.Application")
	Call obApp.Authenticate(user, pw)

	Dim ListFlag
	Dim ListCheck
	Dim ListCount
	ListFlag = false
	For ListCount = 0 To (oMessage.Recipients.count - 1)
		ListCheck = is_local_list(oMessage.Recipients(ListCount).OriginalAddress)
		If ListCheck Then ListFlag = true
		write_log ("Target   : " & oMessage.Recipients(ListCount).OriginalAddress)
		write_log ("Is list? : " & ListCheck )
		write_log ("----------------------------------------")
	Next
	If ListFlag Then
		write_log ("Recipents containing list(s).")
		write_log ("Edit message before sending.")
		add_client_info oClient, oMessage 	'prepare_mailconfiguration oClient, oMessage
	Else
		write_log ("Recipents containing no list(s).")
		write_log ("Keep message untouched.")
	End If
End Sub
Got me I hadn't reviewed the code I just pointed out the fact the code claims to only add the header if it's a list. ;)
Thx for sharing your changes though sure someone else will find it useful.
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***

MattK
New user
New user
Posts: 1
Joined: 2014-09-17 00:49

Re: Distribution list enhancement

Post by MattK » 2014-09-17 00:55

brother.gabriel wrote:Hi, Mr. Toast,

Hmmm...

Now that I look at it, I think my messages have the same problem.

I'll have to look at that.

If anyone has a clue, I'm all ears.
The position for choosing where to insert the HTML footer is wrong - it finds the first end DIV tag - it should find the last so just change InStr to InStrRev.

Code: Select all

		If footerhtml <> "" Then
			write_log (s2 & "Adding html footer")
			pos = InStrRev(oMessage.HTMLBody, "</div")
			If pos < 1 then
				pos = InStr(1, oMessage.HTMLBody, "</body")
			End If
the </body> one is fine as is, there would only be one of these (is often not there which is why it's the fallback option)

drsox
New user
New user
Posts: 18
Joined: 2013-02-10 00:32

Re: Distribution list enhancement

Post by drsox » 2017-09-04 19:15

MattK wrote:The position for choosing where to insert the HTML footer is wrong - it finds the first end DIV tag - it should find the last so just change InStr to InStrRev.
In my installation I've applied this patch and I've also added the following:

To prevent out of office replies and other stuff being sent back to the list or the sender...
Roughly line 295 in EventHandlers.vbs:

Code: Select all

						tmpMessage.HeaderValue("Precedence") = "bulk"
						tmpMessage.HeaderValue("X-Auto-Response-Suppress") = "All"
I also had a problem with the mailing list name being constantly added.. so I would end up with
[BobsList] [BobsList] [BobsList] [BobsList] [BobsList] [BobsList] RE: Meeting tomorrow
Solved by putting an if around the line

Code: Select all

oMessage.Subject = temp & oMessage.Subject
so it reads

Code: Select all

    if InStr(1, oMessage.Subject, temp) = 0 Then
      oMessage.Subject = temp & oMessage.Subject
		End If
Any chance these changes can be compiled back into the original version? I see andyp hasn't been active since 2011 in this thread.

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

Re: Distribution list enhancement

Post by mattg » 2017-09-04 23:21

Can you post back with an updated complete script, and I can then start a new thread (with acknowledgement links to this one) and help keep it maintained for future variations
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2017-12-30 20:02

Good morning. I installed this very useful script and got it working but I have an issue. In the list config, there is a setting:

Code: Select all

# Allow List Commands
# Setting this to false will disable list commands.  The message will then be processed as a normal email.
# If this is set to true, ANYBODY can send list commands to the list.  It doesn't matter whether they are posters or have a password.
# Send help to the list to receive further information
email_subscription=false
If set to false, list commands don't work. If set to true, list commands work but there is no password protection. I want to be able to distribute the password among friends, but not allow any old spammer to subscribe. Is there a way to password protect self-subscription?

drsox
New user
New user
Posts: 18
Joined: 2013-02-10 00:32

Re: Distribution list enhancement

Post by drsox » 2018-03-07 15:07

There is a mailing list access controls bypass bug in the original script!

If someone can trigger the log writing to fail it allows unauthenticated, non-list members or whitelisted senders to send to all the list!

You can trigger the failure by sending an emoji or UTF-8 subject line - I expect other content in the sender or to address would also trigger it.
E.g.

Code: Select all

Subject: =?UTF-8?Q?=F0=9F=92=B8=20BitCoin=20Transfe?==?UTF-8?Q?r=20-=20Yo?= =?UTF-8?Q?u=20received=200.622653=20B?==?UTF-8?Q?TC!?=
The symptoms are - spam gets through to your list and the subject line, headers and footers are not appended to the message.
You see an error like this in the logs:
"ERROR" 1220 "2018-03-07 12:55:43.827" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A0005 - Description: Invalid procedure call or argument - Line: 1702 Column: 3 - Code: (null)"
(The line number might be different as I've got a heavily updated and edited version of the script).
The mailing list script will then go wrong and stop processing any more messages. There will be a ".lock" file in your "C:\Program Files (x86)\hMailServer\Logs" folder that you have to delete to resume mailing list functionality.
hMailServer may even entirely stop processing messages until this lock file is deleted.

I'm too busy at the moment to identify how to gracefully fix this problem.
A workaround is to modify the vbs file like so:

Find the line (the only line) containing:
f.Write(tmp)

Put
on error resume next
before it

and
on error goto 0
after it.

The entire section should read

Code: Select all

			on error resume next
			f.Write(tmp)
			on error goto 0
As a reminder.. I'm using brother.gabriel's base version (viewtopic.php?p=141473#p141473) and then added modifications and bugfixes here:
viewtopic.php?p=198678#p198678
Then the bug fix in this post.

At some point I hope to tidy up my code (as it has my admin details and mailing list passwords in it) and post it as a complete package here.

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2020-03-08 03:03

This script still works! 11 years later and it works with 5.7. And its a pretty cool feature to add to hmailserver.

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2020-03-10 01:27

The script and documentation download disappeared between now and my last post, so I uploaded it to GitHub for future generations. If it was still good after 11 years, chances are it will be good for the next 11. :mrgreen:

https://github.com/palinkas-jo-reggelt/ ... ListServer

drsox
New user
New user
Posts: 18
Joined: 2013-02-10 00:32

Re: Distribution list enhancement

Post by drsox » 2020-03-10 20:40

palinka wrote:
2020-03-10 01:27
I uploaded it to GitHub for future generations.
https://github.com/palinkas-jo-reggelt/ ... ListServer
Just be aware that the original scripts without my modifications have a mailing list authentication / whitelisted sender bypass problem!
See
viewtopic.php?p=202880#p202880

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2020-03-10 20:45

drsox wrote:
2020-03-10 20:40
palinka wrote:
2020-03-10 01:27
I uploaded it to GitHub for future generations.
https://github.com/palinkas-jo-reggelt/ ... ListServer
Just be aware that the original scripts without my modifications have a mailing list authentication / whitelisted sender bypass problem!
See
viewtopic.php?p=202880#p202880
Hey, thanks for looking in. I did incorporate your "fix". Did you ever get around to a real fix?

drsox
New user
New user
Posts: 18
Joined: 2013-02-10 00:32

Re: Distribution list enhancement

Post by drsox » 2020-03-10 20:48

No - nothing better than my on error resume next fix.., it's worked pretty well for me since and I don't have anywhere near enough spare time to make a more elegant fix.

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2020-03-10 22:01

drsox wrote:
2020-03-10 20:48
No - nothing better than my on error resume next fix.., it's worked pretty well for me since and I don't have anywhere near enough spare time to make a more elegant fix.
In any case, its working fine as far as I can tell. :D

User avatar
SorenR
Senior user
Senior user
Posts: 3564
Joined: 2006-08-21 15:38
Location: Denmark

Re: Distribution list enhancement

Post by SorenR » 2020-03-10 22:21

palinka wrote:
2020-03-10 22:01
drsox wrote:
2020-03-10 20:48
No - nothing better than my on error resume next fix.., it's worked pretty well for me since and I don't have anywhere near enough spare time to make a more elegant fix.
In any case, its working fine as far as I can tell. :D
Forked ! :mrgreen:
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

palinka
Senior user
Senior user
Posts: 1921
Joined: 2017-09-12 17:57

Re: Distribution list enhancement

Post by palinka » 2020-03-10 23:30

SorenR wrote:
2020-03-10 22:21
palinka wrote:
2020-03-10 22:01
drsox wrote:
2020-03-10 20:48
No - nothing better than my on error resume next fix.., it's worked pretty well for me since and I don't have anywhere near enough spare time to make a more elegant fix.
In any case, its working fine as far as I can tell. :D
Forked ! :mrgreen:
I just invited you as a collaborator which I think means you can merge your commits any time you want. There's no point in me having control over this thing. I just put it up so it wouldn't be lost into the ether. I don't think github is going anywhere. :D

User avatar
SorenR
Senior user
Senior user
Posts: 3564
Joined: 2006-08-21 15:38
Location: Denmark

Re: Distribution list enhancement

Post by SorenR » 2020-03-11 23:58

palinka wrote:
2020-03-10 23:30
SorenR wrote:
2020-03-10 22:21
palinka wrote:
2020-03-10 22:01


In any case, its working fine as far as I can tell. :D
Forked ! :mrgreen:
I just invited you as a collaborator which I think means you can merge your commits any time you want. There's no point in me having control over this thing. I just put it up so it wouldn't be lost into the ether. I don't think github is going anywhere. :D
Well... I just got plenty time on my hands :roll:

https://www.bloomberg.com/news/articles ... ical-staff
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

Post Reply