Default config for new email account; Virtualmin remote API create-user

When I use the Virtualmin to remote API to create-user... I want to put a pre-configured .procmail file in the .../homes/user directory.

Any ideas how to get that done?

Thanks!

Status: 
Closed (fixed)

Comments

Yes - you can do as follows :

  1. Create the directory /etc/mail-skel containing the .procmailrc file.
  2. Edit the file /etc/webmin/virtual-server/config and add the line mail_skel=/etc/mail-skel
  3. Create your new user.

Your directions worked for me. Except it applies to all domains, and I would like it to work for just one domain.

I've been researching the Server Templates. I created a "new template" and set 'Available to server owners' for 'one.com' domain. I went to 'one.com' domain and set "New Template" as the default. In the "new template" I set the Server templates, Home directory, Skeleton directory for files to /etc/skelnew and it doesn't use it for the mail directory. (I did create the directory and put files in it)

I'm guessing there is no 'mail_skel' setting in VM? ...because 'mail_skel' is for users and not domains?

My question is; where are the new Docs or Examples for Server Templates.. and is there an override for a single domain..?

I found an old page; the 'Example Templates' link is broke. I saw ${IF-MAIL} ... ${ENDIF-MAIL} . But I don't know if and how I can use them.

If you would be so kind to point the way.

Sorry, but there is no way to set a per-template skeleton directory currently.

That is just an awesome answer... better than mine (below). I came back here to post my solution after finding an answer myself. It's different than yours, and its quite open ended, since it will run a script. Thanks for a great product!

** UPDATE ** I could not create a mail folder in the Maildir directory with my script (I assume permissions), I handled this with the solution above (thx Jamie), but the above solution creates the folder for all domains when creating a new user. It there a way to restrict the mail_skel option to one domain?

I thought it best to share my solution and not waste someones time answering my question (even though you did), and I'm hoping someone else can benefit too. :)

Virtualmin -> System Settings -> Virtualmin Configuration -> Action upon server and user creation -> Command to run after making changes to an alias

This runs a script after creating or modifying a domain or its users... so my script has to filter for creating users only (shown below). I only need this for one domain, and the script will execute for any domain, this script will filter the one domain for me (or filter anything).

if test $USERADMIN_DOM = "DOM" &&
   test $USERADMIN_ACTION=CREATE_USER &&
   test $ALIAS_ACTION=CREATE_ALIAS
        then
        PROC= "$USERADMIN_HOME/.procmail"
        cp /home/DOM/homes/procmailrc $PROC
fi

I looked a long time for a solution...even before posting here for help, it was not easy to find that this is where you can hook scripts into the user functions.

Cheers! -Dan www.sharprez.com www.NoBadMail.com

Okay, can/is that on a future features list (a long list I'm sure)?

Is there documentation for the /etc/webmin/virtual-server/config file? If so, where can I find it?

Thanks for a great product! If you can give me a hint... I'm a programmer and could probably get that mod in myself.

Looks like I posted my update minutes after your reply. :)

Cheers!
-Dan
www.SharpRez.com
www.NoBadMail.com

Automatically closed -- issue fixed for 2 weeks with no activity.