Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/8f8473ab531bc988970e2788a71e8eea to your computer and use it in GitHub Desktop.
Save daubac402/8f8473ab531bc988970e2788a71e8eea to your computer and use it in GitHub Desktop.
install Postfix - Dovecot - Squirrelmail on CentOS 7
Remove sendmail
# yum remove sendmail
------------------------------------
Install Postfix
# yum install postfix
------------------------------------
Configure Postfix
# vim /etc/postfix/main.cf
## find and set ##
myhostname = mail.your_domain_here.com
mydomain = your_domain_here.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8
home_mailbox = Maildir/
------------------------------------
Setup auto start + Restart postfix
# systemctl enable postfix
# systemctl restart postfix
------------------------------------
Testing Postfix
# useradd test_mail
# passwd test_mail
# yum install telnet
# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail.your_domain_here.com ESMTP Postfix
ehlo localhost
250-mail.your_domain_here.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<test_mail>
250 2.1.0 Ok
rcpt to:<test_mail>
250 2.1.0 Ok
data
354 End data with <CR><LF>.<CR><LF>
Hello! This is test mail.
.
250 2.0.0 Ok: queued as 9AC752110D
quit
221 2.0.0 Bye
Connection closed by foreign host.
------------------------------------
Check your created mail
# cd /home/test_mail/Maildir/new/
To see mail's content
# cat 1460264935.Vfd00Ic4dd6M808471.mail.your_domain_here.com
------------------------------------
Install Dovecot
# yum install dovecot
------------------------------------
Config Dovecot
# vim /etc/dovecot/dovecot.conf
## Umcomment ##
protocols = imap pop3 lmtp
# vim /etc/dovecot/conf.d/10-mail.conf
## Uncomment ##
mail_location = maildir:~/Maildir
# vim /etc/dovecot/conf.d/10-auth.conf
## Uncomment ##
disable_plaintext_auth = yes
## add "login" ##
auth_mechanisms = plain login
# vim /etc/dovecot/conf.d/10-master.conf
## Find Postfix smtp-auth then edit ##
unix_listener /var/spool/postfix/private/auth {
mode = 0600
user = postfix
group = postfix
}
------------------------------------
Setup auto start + Restart dovecot
# systemctl enable dovecot
# systemctl restart dovecot
------------------------------------
Testing Dovecot
# telnet localhost pop3
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user test_mail
+OK
pass your_test_mail_user_password
+OK Logged in.
retr 1
+OK 447 octets
Return-Path: <test_mail@your_domain_here.com>
X-Original-To: test_mail
Delivered-To: test_mail@your_domain_here.com
Received: from localhost (localhost [IPv6:::1])
by server.admivietnam.org (Postfix) with ESMTP id 9AC752110D
for <test_mail>; Sun, 10 Apr 2016 12:07:49 +0700 (ICT)
Message-Id: <[email protected]>
Date: Sun, 10 Apr 2016 12:07:49 +0700 (ICT)
From: test_mail@your_domain_here.com
Hello! This is test mail.
.
quit
+OK Logging out.
Connection closed by foreign host.
------------------------------------
Install Squirrelmail
# yum install squirrelmail
------------------------------------
config Squirrelmail
# /usr/share/squirrelmail/config/conf.pl
[2] Server Settings
[1] Change your domain to: your_domain_here.com
[3] Change Sendmail to SMTP
[S] Save
[Q] Quit
------------------------------------
add Virtualhost for Squirrelmail in httpd.config (Apache)
# vim /etc/httpd/conf/httpd.conf
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
------------------------------------
Restart Apache
# systemctl restart httpd
And check
http://localhost/webmail
login by your Centos user and password
eg: test_mail, password: 123456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment