CentOS Linux Server Guide

Postfix Mail System- Step by Step Guide

Part 6:  Verify the PostfixAdmin installation

 

In Part 5, let us have a quick check on all our previous configuration

 

Check1: Verify the virtual domains created by Postfixadmin

Let us check on the virtual domains that we created earlier exist in MySQL database. Change your own domain name created earlier in blue text below. You should able to see the the domain reply from the command.

 
postmap -q xyz.local mysql:/etc/postfix/mysql-domains.cf
xyz.local


postmap -q
abc.local mysql:/etc/postfix/mysql-domains.cf
abc.local
 

 

Check2: Verify the virtual domains created by Postfixadmin

Now,let us check if the virtual domain created by postfix are ok.

 

#cd /home/vmail/

#ls -l

abc.local xyz.local   <-- 2 virtual domains created

 

Check3: Check inside the Mysql Database (optional).

If both of the verification on Check1 and 2 fails. You might need to check if the domain created is exisit in your database.

# mysql -u mail -p postfix

mysql> select * from domain;

 

If there is a domain table is empty in Mysql db, please check

  • password and username that used to connect your db

  • make sure your vmail id is correct, use #id vmail command to check your vmail uid and gid again

  • check your config file again if the password, username, vmail uid and gid is correct.

  • vgo back to Step2 and Step4 of the guide to verify your settings.

Check4 : Verify the virtual users created by PostfixAdmin

PostfixAdmin will automatically email users when a new accout created. Let us check on Alex's account and read his mail content.

#cd /home/vmail/abc.local

#ls

alex  <-- virtual user alex created

# cd alex/Maildir/new/

# ls


1270227274.Vfd00I20014M605812.centos.example.local  <--new email


# cat 1270227274.Vfd00I20014M605812.centos.example.local 

Path: <post@example.local>
X-Original-To: alex@abc.local 
Delivered-To: alex@abc.local
Received: from 192.168.139.128 (centos.example.local [127.0.0.1])
by centos.example.local (Postfix) with ESMTP id D41BE4A8096
for <alex@abc.local>; Sat, 3 Apr 2010 00:54:33 +0800 (MYT)
To: alex@abc.local
From: post@example.local
Subject: Welcome
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Message-Id: <20100402165433.D41BE4A8096@centos.example.local>
Date: Sat, 3 Apr 2010 00:54:33 +0800 (MYT)

Hi,

Welcome to your new account.  
<--email content

 

Check5 : Verify the virtual users' password created by PostfixAdmin in Mysql

Dovecot can only read support clear text password created. If you the password created are in encrypted, you might hit Authentication error! Let us have a quick check on alex@abc.local's  password.

# mysql -u mail -p postfix

mysql> SELECT password FROM mailbox WHERE username = 'alex@abc.local';


+----------+
| password |
+----------+
| alex         |
+----------+
1 row in set (0.00 sec)

 

Great! the password created in not encrypted :P .This will ensure that our POP3 can verify the password. Else, go to /software/postfixadmin/config.inc.php again check on line 100.

 
26 $CONF['configured'] = true;
36
$CONF['postfix_admin_url'] = '/postfixadmin';
 

49 $CONF['database_type'] = 'mysqli';
50
$CONF['database_host'] = 'localhost';
51
$CONF['database_user'] = 'mail';
52
$CONF['database_password'] = 'change-your-new-password-here'; 
53
$CONF['database_name'] = 'postfix';
100
$CONF['encrypt'] = 'cleartext';
 

145 $CONF['domain_path'] = 'YES';
151
$CONF['domain_in_mailbox'] = 'NO';

272
$CONF['emailcheck_resolve_domain']='NO';
 

 

Also, go to /etc/dovecot.conf again check if  following setting is correct. Make sure that you also commented out all other passdb and userdb other than passdb sql and userdb static.

 
 61 log_path = /var/log/dovecot.log

721  auth_username_format = %Lu

869  passdb sql {
870  args = /etc/dovecot-mysql.conf
871  }

913  userdb static {
917      args = uid=501 gid=501 home=/home/vmail/%d/%n
927  }
 

 

Check6 : SMTP Relay test

You are advised to perform 2 test both on local host and use another pc. This is to ensure that there are no connection issue such as Firewalls or relay deny from Postfix
telnet centos.example.local 25

220 centos.example.local ESMTP Postfix
helo server
250 centos.example.local
mail from:<alex@abc.local>
250 2.1.0 Ok
rcpt to:<yasmin@xyz.local>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
this is a mail from alex. How are you?
.

250 2.0.0 Ok: queued as 9602D4A80A2
quit
221 2.0.0 Bye
 

 

If the connection fail when performing smtp relay test on other pc. Please go to /etc/postfix/main.cf  then check on the following

93 myorigin = $mydomain

110 inet_interfaces = all  <-- make sure this is not inet_interface=localhost

155 mydestination = $myhostname, localhost.$mydomain, localhost

255 mynetworks = 192.168.139.0/24, 127.0.0.0/8  <--this is the ip that can used to sent email

 

Check7 : Pop3 test

Telnet to P0P3 port 110, and try to read the mail content send by alex@abc.local earlier. This is make sure that both domain can communicate locally.
telnet centos.example.local 110

+OK Dovecot ready.
user yasmin@xyz.local    <- username must @ domain name
+OK
pass yasmin   <- user password
+OK Logged in.
list
+OK 2 messages:
1 599
2 474
.
retr 2
+OK 474 octets
Return-Path: <alex@abc.local>
X-Original-To: yasmin@xyz.local
Delivered-To: yasmin@xyz.local
Received: from server (unknown [192.168.139.1])
by centos.example.local (Postfix) with SMTP id 9602D4A80A2
for <yasmin@xyz.local>; Sat, 3 Apr 2010 06:10:26 +0800 (MYT)
Message-Id: <20100402221039.9602D4A80A2@centos.example.local>
Date: Sat, 3 Apr 2010 06:10:26 +0800 (MYT)
From: alex@abc.local
To: undisclosed-recipients:;

this is a mail from alex. How are you?
.
quit
+OK Logging out.

 

If you faced any problem on this part, please make sure that user password created by PostfixAdmin is not encrypted. Please refer Check 5 above.

 

Check8 : Verify mail sending via Maillog

Reading mail log is to ensure that Postfix is handling both SMTP and POP3 correctly.
#tail /var/log/maillog

Apr 3 06:10:39 centos postfix/smtpd[21575]: 9602D4A80A2: client=unknown[192.168.139.1]
Apr 3 06:10:58 centos postfix/cleanup[21579]: 9602D4A80A2: message-id=<20100402221039.9602D4A80A2@centos.example.local>
Apr 3 06:10:58 centos postfix/qmgr[21313]: 9602D4A80A2: from=<alex@abc.local>, size=378, nrcpt=1 (queue active)
Apr 3 06:10:58 centos postfix/virtual[21590]: 9602D4A80A2: to=<yasmin@xyz.local>, relay=virtual, delay=33, delays=33/0.06/0/0.15, dsn=2.0.0, status=sent (delivered to maildir)
Apr 3 06:10:58 centos postfix/qmgr[21313]: 9602D4A80A2: removed
Apr 3 06:11:32 centos postfix/smtpd[21575]: disconnect from unknown[192.168.139.1]

 

Since, we create a dovecot.log earlier in our /etc/dovecot.conf. I can see if the POP3 traffic is handled by Dovecot correctly.
#tail /var/log/dovecot.log

dovecot: Apr 03 06:29:10 Info: pop3-login: Login: user=<yasmin@xyz.local>, method=PLAIN, rip=::ffff:192.168.139.1, lip=::ffff:192.168.139.128
dovecot: Apr 03 06:29:21 Info: POP3(yasmin@xyz.local): Disconnected: Logged out top=0/0, retr=1/490, del=0/2, size=1073

 

 

 

Check9 : SquirrelMail Check

Login to  http://you-mailserver-ipaddress/webmail now. Login to SquirrelMail  using alex@abc.local and yasmin@xyz.local must be in user@domainname format.  Try to sent email to each other to verify the SquirrelMail is handling the email correctly. If you faced any issue run the http://you-mailserver-ipaddress/src/configtest.php to verify your SquirrelMail setting.

 

Note: If you are setting Mailserver for your orgnization to communicate to external organization. Please also make sure that you have:

  • Valid FQDN domain name

  • Valid MX records

  • Firewall rules to allow POP, SMTP, and IMAP

  • Perform a Open Relay test to avoid Spam Attack

Back to Step by Step Guide on CentOS Linux Postfix Mail Server



Copyright 2011 http://www.1a-centosserver.com All Rights Reserved

All trademarks are the property of their respective owners.

Contact Us | Terms of Use | Privacy Policy