Create 400 email addresses

crussell_1969

Verified User
Joined
May 21, 2007
Messages
8
I am wondering is there is a relatively simple way to create 400 email addresses using the scripts supplied with directadmin. I've got a tab delimited file with the usernames and the passwords and all of the addresses need to be created under one users domain. I was looking at the actual pages in the control panel that do a single email address and I was hoping to modify them but I am not proficient at java programming so I was hoping there is another way.


Thanks,

Craig Russell
 
I do not believe that there are any mass-change scripts that came with DA. I had to do a mass password change for all accounts on the box. I used a perl script from command line to make the changes.
 
If there's an API for creating an email address (I haven't looked it up) you can call it from a loop in a simple script.

Jeff
 
I haven't been able to find an API that I can call from a shell script. I have managed to create everything I need but my last issue is populating the passwords in the virtual domains passwd file. Everything appears to work except for retrieving emails. And it won't accept a blank password. Any ideas on how to create the password hash so I can populate the passwd file?

Thanks,

Craig
 
In order to place the password into the password file, you will need to use an MD5 password generator, such as the one located at http://www.trilug.org/~jeremy/md5.php. Enter the password you wish for the account to have, then place the MD5 hash into the password file. If you are looking for an API method, maybe this will help: http://www.directadmin.com/api.html#email. Hope this helps.
 
That method would probably have been easier. My solution was as follows;

I was provided with an excel spreadsheet with the usernames and passwords in them. The format was in all uppercase so I split out the usernames and created a file with the lowercase usernames and kept the file with both seperate.


for i in `cat user.lowercase`
do
htpasswd -b passwd $i `cat user.pass | grep -i $i | awk '{print $2}'`
touch /var/spool/virtual/domain.com/$i
chown domainowner:mail /var/spool/virtual/domain.com/$i
done

This created the passwd file I needed in /etc/virtual/domain.com and created the mail file in /var/spool/virtual/domain.com

I then just copied the passwd file into the quota file and dropped the passwords and added a 0.

So far so good.

I am sure there are better ways to do this but this seems to have worked.

Thanks for the replies

Craig Russell
 
Back
Top