LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Steps for creating virtual email boxes (https://www.linuxquestions.org/questions/linux-server-73/steps-for-creating-virtual-email-boxes-561088/)

satimis 06-12-2007 01:28 AM

Steps for creating virtual email boxes
 
Hi folks,

OpenBSD 4.0 X86_64
Mysql
Postfix-2.4.3


Please shed me some light on creating virtual email boxes.

For example
To set up a virtual email box for "Albert Jones", I run;

$ su
password
# su - _vmail
$ mkdir -p satimis.com/albert
$ maildirmake satimis.com/albert/Maildir
$ maildirmake -q 10000000S satimis.com/albert/Maildir

all went through w/o complaint.

$ mysql -u root -p
Code:

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.24a-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


Now I can't recall whether having run following command before;
Code:

mysql> insert into postfix_virtual_domains values
('1','satimis.com','maildrop:');

Is there any way to check??? If NO can I re-run the command? Any possible mistake created in doing so? Tks.


To create an account for "albert" whether to run;
Code:

mysql> insert into postfix_users
(email,clear,name,homedir,maildir,quota) values
('albert@satimis.com','UzeR0nePazz','Albert Jones','/var/mail/vmail','satimis.com/albert/Maildir/','10000000');

then
Code:

mysql> \q
That is all (same procedure for creating other accounts) ???


Is the above command correct? Afterwards how to check it is working locally on the email server instead of sending albert an email from another LAN? TIA


B.R.
satimis

Avinash 06-13-2007 11:28 AM

virtemail
 
From what it looks like, that's all correct. Check out my informal script here..

Code:

root@www:/home/vmail# cat add_email.sh
#!/bin/bash
echo "This will create a new email address, there is no escaping so enter evryth
ing escaped"
echo -n "Domain of address: "
read -e DOMAIN
echo -n "Username (without the domain): "
read -e USER
echo -n "Pass (shows in cleartext): "
read -e PASS
echo "now createing mysql entries"

#add the domain if not there (the unuiqe index stops duplicates)
echo "USE email; " > /tmp/mysql.batch.tpl.7863
echo "INSERT IGNORE INTO postfix_transport (domain,  destination) VALUES('$DOMAI
N', 'maildrop:');">> /tmp/mysql.batch.tpl.7863
echo "INSERT IGNORE INTO postfix_users (email, clear, homedir, maildir) VALUES('
${USER}@${DOMAIN}', '$PASS', '/home/vmail', '$DOMAIN/$USER/Maildir');" >> /tmp/m
ysql.batch.tpl.7863

#cat /tmp/mysql.batch.tpl.7863

echo "MYSQL ROOT PASS"
mysql -u root -p < /tmp/mysql.batch.tpl.7863
echo "you can ignore a DUP entry error"
rm /tmp/mysql.batch.tpl.7863

echo "now creating the folder structer (ignore any already exist stuff)"
mkdir /home/vmail/$DOMAIN
mkdir /home/vmail/$DOMAIN/$USER
/usr/local/bin/maildirmake /home/vmail/$DOMAIN/$USER/Maildir
chown -R vmail:vmail /home/vmail/$DOMAIN
echo "all done"



All times are GMT -5. The time now is 04:50 AM.