Limit outbound mails by user, domain or server average

This section contains scripts that hMailServer has contributed with. hMailServer 5 is needed to use these.
ttambellini
New user
New user
Posts: 22
Joined: 2013-07-14 19:03
Location: Pittsburgh, PA

Re: Limit outbound mails by user, domain or server average

Post by ttambellini » 2013-07-18 21:34

Great explanation! You're right, that secondary log file is pretty useless once everything is verified as working correctly. Didn't even consider turning that logging off after everything is fully tested. Thanks for mentioning that, because that's exactly what I'll do.

From everything I can see, this seems to work perfectly now! Thank you!

I will make a point of checking the hmailserver forum from time to time in hopes that I can help someone else someday and "pay it forward".

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

Re: Limit outbound mails by user, domain or server average

Post by mattg » 2013-07-19 00:53

ttambellini wrote:I'm used to working with software companies that sell overpriced crappy software and offer very little support. My experience with hmailserver has been the exact opposite; Great software at no cost, and folks willing to help because they like helping out their fellow hmailserver users.
That, and the fact that hMailserver is VERY customisable by the use of built in scripting (like this thread) are the reasons that I volunteer here.

I find hMailserver very intuitive and easy to use / customise.
I can't think of another product that I use that matches the combination of 'simple to use' and yet 'highly customisable'.
ttambellini wrote:I will make a point of checking the hmailserver forum from time to time in hopes that I can help someone else someday and "pay it forward
Excellent.

I also use the helping others as a 'learning experience' for me. I'm self taught.
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
mattg
Moderator
Moderator
Posts: 20468
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Limit outbound mails by user, domain or server average

Post by mattg » 2013-07-19 00:56

percepts wrote:Limit SMTP VERSION 6

I have made quite a few more modifications and cleanup to script and recreated zip file which contains everything you need with install instructions. Consider this zip file an updated alternative to the one in post 1 of this topic.
I have therefore called it Version 6 of script.
How about you start a new thread with this version in the first post of that thread.

Good work percepts.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Limit outbound mails by user, domain or server average

Post by percepts » 2013-07-19 01:42

Done.

Metalik
New user
New user
Posts: 13
Joined: 2013-10-02 10:41

Re: Limit outbound mails by user, domain or server average

Post by Metalik » 2014-03-15 11:57

Hello

It does not work with base64 encoded authentication:

http://www.hmailserver.com/documentatio ... d_for_spam
"<spammers IP address>" "RECEIVED: AUTH LOGIN"
"<spammers IP address>" "SENT: 334 VXNlcm5hbWU6"
"<spammers IP address>" "RECEIVED: dGVzdEB0ZXN0LmNvbQ=="
"<spammers IP address>" "SENT: 334 UGFzc3dvcmQ6"
Regards

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Limit outbound mails by user, domain or server average

Post by percepts » 2014-03-15 15:54

you are wrong or at least your interpretation of why its not working is wrong.

Please show link to post which you downloaded the script from. There are many versions of the script.

Metalik
New user
New user
Posts: 13
Joined: 2013-10-02 10:41

Re: Limit outbound mails by user, domain or server average

Post by Metalik » 2014-03-16 10:26

percepts wrote:you are wrong or at least your interpretation of why its not working is wrong.

Please show link to post which you downloaded the script from. There are many versions of the script.
Link is: http://www.hmailserver.com/forum/viewto ... 47#p151947

I have installed it, but one of our users sent a lot of emails without any limitation.

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Limit outbound mails by user, domain or server average

Post by percepts » 2014-03-16 15:08

I would look at using following instead

http://www.hmailserver.com/forum/viewto ... 20&t=25741

Sjender
Normal user
Normal user
Posts: 49
Joined: 2012-02-25 10:13

Re: Limit outbound mails by user, domain or server average

Post by Sjender » 2014-06-03 16:53

Hello,

I have installed the V6 script.

Logs seems fine and while testing I received a "warning" and "locked" message. However, after the locked message I can still send e-mails without any problems...

Do I perhaps missing something? :|

gianniskapouekei
Normal user
Normal user
Posts: 64
Joined: 2017-09-29 13:09

Re: Limit outbound mails by user, domain or server average

Post by gianniskapouekei » 2017-10-16 18:35

hi...how i can limit an account or domain???? I would like you to tell me how to send me an email when an account reaches the limit. thanks very much...

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

Re: Limit outbound mails by user, domain or server average

Post by mattg » 2017-10-16 23:29

Did you even read this thread?

go back to the first page of this thread, and implement the script as instructed
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gianniskapouekei
Normal user
Normal user
Posts: 64
Joined: 2017-09-29 13:09

Re: Limit outbound mails by user, domain or server average

Post by gianniskapouekei » 2017-10-17 14:50

hi....i add this script and is very usefull. but i have a question...

Public obApp
Public domain_buffer
Public Const ipslocalhost = "0.0.0.0" 'separated by #
Public Const user = "Administrator"
Public Const pw = "xxxxxxxxxxx"
Public Const logspath = "C:\MailServer\Events\" 'ends with a backslash
Public Const write_log_active = true



in 5 line. 'Public Const pw ' i must be to put the password????thanks

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

Re: Limit outbound mails by user, domain or server average

Post by jimimaseye » 2017-10-17 14:53

yes
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

gianniskapouekei
Normal user
Normal user
Posts: 64
Joined: 2017-09-29 13:09

Re: Limit outbound mails by user, domain or server average

Post by gianniskapouekei » 2017-10-17 15:23

hi...thanks very much for your answer....

'User and Domain outgoing limitation
Public Const outgoingstore = "C:\MailServer\Events\outboundstore.txt"
Public Const outgoingexceptions = "C:\MailServer\Events\outboundexceptions.txt"
Public Const outgoingstoreavg = "C:\MailServer\Events\outboundstoreavg.txt"


i have a small problem...i have chnage the path of the folders..the Public Const outgoingstore and Public Const outgoingexceptions write corrent in the folder but the Public Const outgoingstoreavg write a home directory of the hmail server but and this have the path with the rest...

kdiamond
Normal user
Normal user
Posts: 86
Joined: 2013-03-20 10:51

Re: Limit outbound mails by user, domain or server average

Post by kdiamond » 2018-03-23 15:10

Thank you Andyp for this great script.

One question...
outboundstore.txt will store number of emails sent by the users and domains. Is this for the script functionality or just a log? Do I need to clear/delete it daily using task scheduler in order for the script to function on daily base?

Thank you

Br,
Dali

ttambellini
New user
New user
Posts: 22
Joined: 2013-07-14 19:03
Location: Pittsburgh, PA

Re: Limit outbound mails by user, domain or server average

Post by ttambellini » 2018-03-23 19:26

outboundstore.txt is a log used for the script functionality.

You do not need to edit this file or change it in any was yourself. I don't remember if it resets daily or keeps a running total of mail sent in the last 24 hours, but the values are updated by the script, then compared to the limits in the script or in the outboundexceptions file.

As a side note, you can edit this file, and I will do that sometimes if a user is sending a lot of emails one day and they start getting close to their limit, I will reduce the number of emails sent as shown in this file, and that essentially "turns back the counter" for that user's limit.

kdiamond
Normal user
Normal user
Posts: 86
Joined: 2013-03-20 10:51

Re: Limit outbound mails by user, domain or server average

Post by kdiamond » 2018-03-24 13:17

Thank you for reply.

Yes, it seems it's been doing the job automatically. I was just confused with point 10 in the manual about CycleEvents.vbs/txt that I am not able to find anywhere and I don't know what it actually does.
10 The hmailserver_events.log file needs to be cycled since there is no hmail inbuilt procedure for this. To do this setup a windows task scheduler job to run CycleEventLog.vbs (rename CycleEventLog.txt to CycleEventLog.vbs ) on a daily, weekly or monthly cycle according to which you prefer. (daily works best IMO)
On the other hand the script works great so far. The only thing I had to comment in the scrip is 'Option Explicit as it wasn't working with script in the EventHandlers.vbd.

This is the script for ruining batch file on every incoming mail.

' OSTICKET CRON (on every email RUN the batch)
Sub Osticket_cron(oMessage)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "c:\Util\Scripts\Osticket_cron.bat", 1, false
End Sub

Should I expect any problems if I comment out Option Explicit?

Thank you
Br,
Dali

kdiamond
Normal user
Normal user
Posts: 86
Joined: 2013-03-20 10:51

Re: Limit outbound mails by user, domain or server average

Post by kdiamond » 2018-03-24 13:26

I'm actually a basic user with only a few domains and email accounts. no big deal. I'm coming from Mdeamon. HMS had been great form me for past few years. No problems. Mostly got hacked by a test accounts with simple, not strong, passwords like test123, user123 and such. Yes, my fault, no doubt. I should use strong passwords. But it blacklisted me for fewl times now. And more users one have more options to get hacked. I'm also not familiar how other mail servers are dealing with this, but I believe this should be a core functionality od any email server and enabled by default. Then the admin could add exceptions when needed. When ip gets blacklisted, all other mail users gets punished for several days.

Thank you

Br,
Dali

Post Reply