Postfixadmin Installation:
[root@www /]# uname -a
Linux www..be 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x8 6_64 x86_64 GNU/Linux
1. google download postfixadmin
2. tar xvfz postfixadmin_2.3.tar.gz.tar.gz -C /usr/share/
3. yum install php-imap.i686
* restart the httpd -k restart
4. vi /usr/share/postfixadmin-2.3/config.inc.php
config.$CONF['configured'] = true;
// Database Config
$CONF['database_type'] = ‘mysql’;
$CONF['database_host'] = ‘localhost’;
$CONF['database_user'] = ‘root’;
$CONF['database_password'] = ”;
$CONF['database_name'] = ‘postfix’;
// Encrypt
$CONF['encrypt'] = ‘cleartext’; // shamun
[SAVE]
5. http://localhost/postfixadmin/setup.php
6. when you make setup password, copy the given line and past in the following file.
vi /usr/share/postfixadmin-2.3/config.inc.php
$CONF['setup_password'] = 'b90d3eceb6e475e85e92b04eb5d6cbd1:e80d6fa140cb7ea3a65783e16e7afc3ebdaa712f';
7. you make admin account thats it.
Note important:
8. make a virtual domain like i did: shamun.be
9. make a virtual email like marie@shamun.be
- this will be needed for a test emails, at the end
Postfix Installation:
1. Add user
[root@www ~]# useradd vmail
[root@www ~]# id vmail
uid=501(vmail) gid=501(vmail) groups=501(vmail) context=user_u:system_r:unconfined_t
[root@www ~]#
2. Install postfix with mysql support (default is without mysql)
[root@www etc]# vi /etc/yum.repos.d/CentOS-Base.repo
#[base] and [update] sections of /etc/yum.repos.d/CentOS-Base.repo added
exclude=postfix-*
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
includepkgs=postfix-*
[root@www ~]# yum install postfix
Installed:
postfix.x86_64 2:2.3.3-2.1.centos.mysql_pgsql
[root@www postfix]# postconf -m
btree
cidr
environ
hash
ldap
mysql
nis
pcre
pgsql
proxy
regexp
static
unix
[root@www ~]# whereis postfix
postfix: /usr/sbin/postfix /etc/postfix /usr/libexec/postfix /usr/share/man/man1/postfix.1.gz
3. vi /etc/postfix/main.cf
# My edits
virtual_mailbox_domains = mysql:/etc/postfix/mysql-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-aliases.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:501
virtual_gid_maps = static:501
# [optional] but important in production:
# important, this part of postfix is for incoming emails to receive
# when i send email from hellobello@gmail.com to this@setup.com
# Email bounced and gets fail: The error that the other server returned was: 550 550 5.1.1
# So, put this as following
local_recipient_maps = # leave empty incase you want public and local test get success
inet_interfaces = all # instead of localhost
#[optional] - spamm protect
# Spamm kill
permit_mynetwork= $mynetworks
check_relay_domains = $relay_domains, $inet_interfaces
smtpd_helo_required = yes
smtpd_recipient_restrictions =
permit_mynetworks,
check_client_access hash:/etc/postfix/clients,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client pbl.spamhaus.org,
reject_rbl_client sbl.spamhaus.org,
reject_unauth_destination
# test local mail to outside
# test outside mail to inside
# (Test this from shell, that nobody using your box sending emails): telnet relay-test.mail-abuse.org
4. vi /etc/postfix/mysql-domains.cf
# config
host = localhost
user = root
password =
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'
#
# Side work - postfixadmin
# add domains ex: mydomain.com
# add email address ex: me@mydomain.com
#
5. Test point 4
[root@www postfix]# postmap -q yourdomain.com mysql:/etc/postfix/mysql-domains.cf
yourdomain.com
6. vi /etc/postfix/mysql-users.cf
host = localhost
user = root
password =
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
additional_conditions = and active = '1'
result_format = %sMaildir/
7. Test point 6
[root@www postfix]# postmap -q support@yourdomain.com mysql:/etc/postfix/mysql-users.cf
support@yourdomain.com/Maildir/
[root@www postfix]#
8. start postfix
[root@www postfix]# postfix reload
[root@www postfix]# service postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
[root@www postfix]#
9. Send mail
[root@www postfix]# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 www.yourdomain.com ESMTP Postfix
ehlo host
250-www.yourdomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: support@yourdomain.com
250 2.1.0 Ok
rcpt to: webmaster@yourdomain.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Dear Marie,
How are you? Alles goed?
Mvg
Shamun
.
250 2.0.0 Ok: queued as 4E20D5F88033
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@www postfix]#
[root@www home]# tree
.
|-- shamun
`-- vmail
`-- webmaster@yourdomain.com
`-- Maildir
|-- cur
|-- new
| `-- 1269444409.Vfd00I13d0017M216619.www.yourdomain.com
`-- tmp
7 directories, 1 file
[root@www home]#
Dovecot Installation:
1. Install dovecot (dovecot-mysql not need in centos 5.4)
[root@www home]# yum install dovecot.x86_64
Installed:
dovecot.x86_64 0:1.0.7-7.el5
2. Edit
[root@www home]# whereis dovecot
dovecot: /usr/sbin/dovecot /etc/dovecot.conf /usr/libexec/dovecot
[root@www home]# vi /etc/dovecot.conf
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
protocols = pop3 pop3s imap imaps
##
## Mailbox locations and namespaces
##
mail_location = maildir:~/Maildir/
##
## IMAP specific settings
##
protocol imap {
imap_client_workarounds = delay-newmail outlook-idle netscape-eoh
}
##
## POP3 specific settings
##
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
##
## Authentication processes
##
# For 64-bit users: Add the line login_process_size = 64 in the file /etc/dovecot.conf.
auth_username_format = %Lu
auth default {
passdb sql {
args = /etc/dovecot-mysql.conf
}
userdb static {
#args = uid=501 gid=501 home=/home/vmail/%d/%n
#/home/vmail/shamun.be/marie/Maildir/new
args = uid=501 gid=501 home=/home/vmail/%u
#/home/vmail/marie@shamun.be/Maildir/new i am using this way!
}
}
3. vi /etc/dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=postfix user=root password=
default_pass_scheme = PLAIN
password_query = SELECT password from mailbox where username = '%u'
4. Start dovecot
[root@www home]# service dovecot restart
Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: [ OK ]
5. Test
[root@www home]# telnet localhost pop3
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
user webmaster@example.com
+OK
pass xxxxxxxxxx
+OK Logged in.
list
+OK 1 messages:
1 520
.
quit
+OK Logging out.
Connection closed by foreign host.
[root@www home]#