I want to customize the daily User email limit files based on a custom package item


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Email » Exim
Top Level » DirectAdmin » Custom Scripting

I want to customize the daily User email limit files based on a custom package itemLast Modified: May 28, 2016, 2:02 pm
With the addition of the custom package items, you can now use these items to control other areas of your system.  For this example, we'll have these items control the daily email limit of a User (/etc/virtual/limit_username).

1)The first step is to add a custom package item.  See this guide on how to do that.  For this example, use a 'text' value.  Give the variable a name called user_email_limit

2)Next, we need to have this option do something.  By default, the item is only stored in the user.conf file.. it won't do anything.
To have it do something, create the script /usr/local/directadmin/scripts/custom/user_create_post.sh.   Inside that file, add this code:

#!/bin/sh
if [ "$user_email_limit" != "" ] && [[ $user_email_limit =~ ^-?[0-9]+$ ]] && [ "$user_email_limit" -gt 0 ]; then
    echo -n "$user_email_limit" > /etc/virtual/limit_$username
fi
exit 0;



Once the User is created, this package variable will no longer have any effect, meaning changing it from the package won't have any effect (you can if you want by creating a similar user_modify_post.sh).
The way to change the per-User email limit setting would be normally through:

Reseller Level -> List Users -> Username -> E-Mail Limit


© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST