Setup Basic POP3/IMAP Mail Server in Centos/RHEL
Setting up a mail server will be quite daunting if you're a UNIX system beginner. i'm posting here my straightforward and most elementary mail server experiment that I conducted with my VPS server in order that my documentation may be useful for those that need to line up a pop3 or IMAP mail server..What you Need
- Linux Server with Centos 4/5 (VPS or Dedicated)
- Apache 2 with PHP4 or later
- Postfix (SMTP server or MTA)
- Dovecot ( IMAP/POP3 server)
- Squirrelmail (A free Webmail)We will be putting in the e-mail server for native users wherever they'll use webmail or outlook categorical to access their email. we'll be putting in an easy and most simple mail server for native users.
What you ought to know?
Before we have a tendency to proceed to line up a mail server, the subsequent three ar most significant for delivering email to the destination. If you do not then most of the e-mail origination from your server can finish up on spam folders in major free email suppliers like Hotmail or AOL etc.
1. DNS Entry for your mail server with flux unit record
2. Setup associate degree SPF record (see openspf.org )
3. Setup name Keys
4 . Reverse informatics for your Mail Server
The most necessary of it putting in reverse informatics for your mail server. you have got to raise your hosting supplier to line up a reverse informatics for your mail server. Most email suppliers can operation reverse DNS for the emails originating from your server to tell apart from spam.
Install ending (SMTP Server/MTA)
Postfix could be a quick and fashionable SMTP server and wide used. Its main job is to relay mail domestically or to associate degree meant destination outside the network. a number of the foremost fashionable SMTP servers ar Sendmail, postfix, and qmail.
By default, Sendmail comes pre-installed with centos. we are going to want ought to take away it and install ending.
Code: Select all
yum remove sendmail
yum install postfixThe configuration file is found at /etc/postfix/main.cf. Edit the file and check that you alter the subsequent lines along with your name.
Code: Select all
myhost= mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, $mydomainYou have to take care concerning $mydestination is as a result of it restrictions receiving emails by the server referring to domains.
NOTE: make certain you uncomment inet_interfaces = localhost if you're enabling all possibility. I usually created that dreadful mistake deed each uncommented!
Setting up SASL + TLS
We have to conjointly setup SASL with our termination to certify our users United Nations agency need to send email outside of the permissible network. we tend to dont need our mail server to be open relay and thereby limiting causation mail solely to the native users. while not SASL authentication termination can provide relay access denied error if you commit to send mail outside of the network.
Code: Select all yum install cyrus-sasl To enable SASL authentication open /etc/postfix/main.cf and add the following lines
Code: Select all smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/authInstall Dovecot (POP3/IMAP Server)
Dovecot may be a very talked-about POP3/IMAP server. the most distinction between POP3 and IMAP is whereas accessing your email with outlook if you utilize POP3 the mail is downloaded to your laptop and deleted from the server. With IMAP the mail is preserved within the server. IF any downside happens whereas downloading the emails area unit lost with POP3. The configuration file is found at /etc/dovecot.conf
Code: Select all yum install dovecot Open the dovecot config file /etc/dovecot.conf and build the subsequent changes. you'll ought to comment or uncomment sure lines
Code: Select all protocols = imap imaps pop3 pop3s Look for the line auth default and make these changes. Be careful with the lines as they are heavily commented out.
Code: Select all auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}Install Squirrelmail
Squirrelmail could be a free webbased email is terribly handy for your users to login whereas they're mobile.
Code: Select all yum install squirrelmail To setup the squirrelmail under apache, open /etc/httpd/conf/httpd.conf and insert the following lines
Code: Select all Alias /squirrelmail /usr/local/squirrelmail/www
<Directory /usr/local/squirrelmail/www>
Options Indexes
AllowOverride none
DirectoryIndex index.php
Order allow,deny
allow from all
</Directory>The squirrelmail configuration utility is found in /usr/share/squirrelmail/config/conf.pl
Run the configuration utility and set the server settings to SMTP and alter your name to example.com
Code: Select all /usr/share/squirrelmail/config/conf.pl Before you access squirrelmail or mail restart all the services
Code: Select all
/etc/init.d/postfix start
/etc/init.d/dovecot start
/etc/init.d/saslauthd start
service httpd restart
To access squirrelmail point your browser to http://www.domain.com/webmail and the squirrelmail test page is located athttp://domain.com/webmail/src/configtest.php
Before we login to squirrelmail, you will need to create users.
Create Local Users
Just create a localuser with adduser
Code: Select all adduser john Open squirrelmail and enter the username as john and therefore the countersign
Using Outlook specific
To use outlook specific produce a mail account and take a look at connecting to the server.
Email: [email protected]
Incoming POP3 settings: mail.domain.com
Outgoing POP3 settings: mail.domain.com
UserName: john
Password: xxxx
NOTE: Before causation any outgoing email with outlook, check that you tick the My server needs authentication underneath server settings.
FAQs
I am obtaining DNS error from my mail server? what entries ought to be created in DNS zone file?
If you're victimization mail.domain.com then mail ought to have a CNAME record in your dns zone file in conjunction with the maxwell record for the domain.
Code: Select all domain.com. IN MX 1 domain.com.
mail IN CNAME domain.com.How do i check whether or not mail server is functioning or not?
The simplest thanks to check for your mail server operating is enter your domain in pingability.com or dnsstuff.com and check for the errors. you'll additionally wish to search out if it's not open relay. Check your log file /var/log/maillog for any errors also.
Another way to check your mail server is exploitation telnet. you'll get output just like the one below.
Code: Select all > telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.simplegerman.com ESMTP Postfix
ehlo simplegerman.com
250-mail.simplegerman.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
- 0 Users Found This Useful