Enlarge limit mails to specific user with /etc/virtual/user_limit set

francisco.

Verified User
Joined
Nov 18, 2014
Messages
12
Hello,

I need enlarge to 500 limit mails to specific user, just one user, but It is setting limit on /etc/virtual/user_limit to 100 for all users.

How could I carry through?

Regards
 
I found this:

4) If you wish to have a custom limit for one or more email address, create a limit in the following path, which will override the /etc/virtual/user_limit file.
echo 100 > /etc/virtual/domain.com/limit/user

where "user" is without the @domain.com.


** Note that setting a user limit value higher than the /etc/virtual/limit, or /etc/virtual/limit_username will not bypass this limit.
The DA-User limit is still in place and is enforced if enabled.


Note ins this case is the problem, how can I get it?
 
If I'm reading your post correctly...

First you need to create a usrlevel limit post for the directadmin user with the higher limit:
Code:
echo 500 > /etc/virtual/limit_USERNAME
where USERNAME is the correct account username for the domain.

Then the default outgoing limit for all email accounts for that user will be 500.

If you need to lower the default outgoing email limit for other email accounts under this user, then you need to do it individually.

For example, if you've got three email accounts for that user: [email protected], [email protected], and [email protected], and if you want [email protected] to be able to send 500 emails daily, but the others (email2 and email3) to only be able to send 100 emails daily, then you don't do anything else for email1 since the default limit is now 500 daily outgoing emails, but you need to set new lower limits for email2 and email3.
Code:
echo 100 > /etc/virtual/example.com/limit/email2
and
Code:
echo 100 > /etc/virtual/example.com/limit/email3
Jeff
 
If I'm reading your post correctly...

First you need to create a usrlevel limit post for the directadmin user with the higher limit:
Code:
echo 500 > /etc/virtual/limit_USERNAME
where USERNAME is the correct account username for the domain.

Then the default outgoing limit for all email accounts for that user will be 500.

If you need to lower the default outgoing email limit for other email accounts under this user, then you need to do it individually.

For example, if you've got three email accounts for that user: [email protected], [email protected], and [email protected], and if you want [email protected] to be able to send 500 emails daily, but the others (email2 and email3) to only be able to send 100 emails daily, then you don't do anything else for email1 since the default limit is now 500 daily outgoing emails, but you need to set new lower limits for email2 and email3.
Code:
echo 100 > /etc/virtual/example.com/limit/email2
and
Code:
echo 100 > /etc/virtual/example.com/limit/email3
Jeff

Perfect. But I am looking for opposite case.

Default outgoing limit for all email accounts is 500 however an individual account needs to be able to send more emails e.g. [email protected] = limit 700.
 
Same way. But you must set the entire user to 700, and then all the other users to lower.

I thought I made that clear in my original reply.

Jeff

Same way?

According to this information, http://www.directadmin.com/features.php?id=1246

** Note that setting a user limit value higher than the /etc/virtual/limit, or /etc/virtual/limit_username will not bypass this limit.

I do not think so.
 
It is exactly what Jeff say.

You are confused cause the "user" word may be not-well understood, you need to make clean two different kind of user
First is USERNAME of the DA ACCOUNT, the second is the USERNAME of the email account (the part before @domain.tld)

Make for example that main username is MAX and his domain is MAXDOMAIN.tld

so, lets set a limit for the entire user MAX

echo "500" > /etc/virtual/limit_max

Now, lets say that MAX user have [email protected] email and you wanna limit this email to 50:

echo "50" > /etc/virtual/maxdomain.tld/limit/info

As you can see, the single email value is LOWER than the user value, if i had put 5000 instead of 50, that value was invalid and the limit was set to 500 cause user MAX limit is 500.

Also, keep in mind that once you set a limit for a user (or a general limit), you can set a limit for each email account directly from DA web interface that MUST be lower than the main limit itself.

Also notice, that if you dont set a limit for the user account, than you can directly limit the single emails account, but keep in mind that set an email to 0 will be set as "no limit", and that's pretty insecure.

Regards
 
Last edited:
It is exactly what Jeff say.

You are confused cause the "user" word may be not-well understood, you need to make clean two different kind of user
First is USERNAME of the DA ACCOUNT, the second is the USERNAME of the email account (the part before @domain.tld)

Make for example that main username is MAX and his domain is MAXDOMAIN.tld

so, lets set a limit for the entire user MAX

echo "500" > /etc/virtual/limit_max

Now, lets say that MAX user have [email protected] email and you wanna limit this email to 50:

echo "50" > /etc/virtual/maxdomain.tld/limit/info

As you can see, the single email value is LOWER than the user value, if i had put 5000 instead of 50, that value was invalid and the limit was set to 500 cause user MAX limit is 500.

Also, keep in mind that once you set a limit for a user (or a general limit), you can set a limit for each email account directly from DA web interface that MUST be lower than the main limit itself.

Also notice, that if you dont set a limit for the user account, than you can directly limit the single emails account, but keep in mind that set an email to 0 will be set as "no limit", and that's pretty insecure.

Regards

Thanks for you repply Sellerone.

So, how could get that goal?

Must I unlimit main limit and limit one by one account?.
 
You need to limit a single email account or a directadmin user?

In the second case use

echo "500" > /etc/virtual/limit_user

For the first case, you may do "unlimit" the user using

echo "0" > /etc/virtual/limit_user

OR (better), limit the user to the higher number (so, the one you're gonna set to the single email) and than yes, you need to set each email account to the needed value in each case.

Regards
 
Hello
I need to set
echo 100 > /etc/virtual/domain.com/limit/user
for 10000 emails of an account.
one by one can be done by directadmin
is there a way to bulk limit emails?

I know Daily limit per E-Mail Account can be set
but for some important reason,it is :
Daily limit per E-Mail Account = 3000
I want only emails of one account (that has 10000 emails ) to be : 100
so i should put all 10000 emails to echo 100 > /etc/virtual/domain.com/limit/user
but how?
 
Last edited:
I think you may need to use bash scripting to acchieve that.

I cannot prepare the code for you today but if you remember me on monday i'll do it.

Best regards
 
Thank you , I will remember you.
If somebody else can help sooner, I'll be so happy for her/his help.
 
Hi, you can use this script i've just created:

Code:
#!/bin/bash

###############################################################################
###############################################################################
#                                                                             #
#                                Crazy Network                                #
#                                                                             #
#   Web & Shell Hosting - Assemblaggio PC - Assistenza Tecnica - Web Design   #
#                                                                             #
#                           http://www.CrazyNetwork.it                        #
#                                                                             #
#                              [email protected]                           #
#                                                                             #
###############################################################################
###############################################################################

echo ""

if [ "$1" = "" ]; then
        echo "Please specify domain name and per E-Mail Account limit"
        exit 1;
else
        if [ -d /etc/virtual/$1/ ]; then
                echo "DOMAIN: $1"
                DOMAIN=$1
        else
                echo "Domain domain $1 not present on this server"
                echo ""
                exit 2;
        fi
fi

if [ "$2" = "" ]; then
        echo "LIMIT: 500"
        LIMIT=500
else
        echo "LIMIT: $2"
        LIMIT=$2
fi

if [ "`cat /etc/virtual/$DOMAIN/passwd | wc -l`" != "0" ]; then
        mkdir -p /etc/virtual/$DOMAIN/limit/
        for ACCOUNT in `cat /etc/virtual/$DOMAIN/passwd | cut -d: -f-1`; do
                echo "$LIMIT" > /etc/virtual/$DOMAIN/limit/$ACCOUNT
                chown mail:mail /etc/virtual/$DOMAIN/limit/$ACCOUNT
        done
        echo "RESULT: Operation completed successfully"
else
        echo "RESULT: No E-Mail Accounts for domain $DOMAIN"
        echo ""
        exit 3;
fi

echo "action=cache&type=popquota" >> /usr/local/directadmin/data/task.queue && /usr/local/directadmin/dataskq >/dev/null 2>&1
echo ""
exit 0;

Save it as set_email_send_limit.sh

Usage: ./set_email_send_limit.sh DOMAIN LIMIT
Example:
Code:
./set_email_send_limit.sh test-server.it 100

DOMAIN: test-server.it
LIMIT: 100
RESULT: Operation completed successfully

It also check for domain with no e-mails or wrong domains.

Code:
./set_email_send_limit.sh test-domain.it 10

DOMAIN: test-domain.it
LIMIT: 10
RESULT: No E-Mail Accounts for domain test-domain.it

Code:
./set_email_send_limit.sh test.it 10

Domain domain test.it not present on this server

Best regards
 
Thank you very much .
Worked perfectly
I wish to be a person like you.
really good work
 
Last edited:
Back
Top