Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server

From Notes_Wiki
Revision as of 05:39, 28 November 2014 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb> =Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single se...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb>

Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server

In case of a completely new domain, one can create an account on AWS and use micro instance for testing configuration. A domain name can also be purchased

AWS Account creation and DNS entries

  1. Create a dedicated amazon account
  2. Create CentOS micro instance with public IP
  3. Take an elastic IP and associate with VM
  4. Ensure that security group of VM allows SSH, HTTP, HTTPS, IMAP, IMAPS, SMTP, STMPS, POP3, POP3S and ICMP
  5. Register domain name through registrar such as godaddy
  6. Update DNS entries for domain, www, mail, MX record to point to elastic IP of the VM


Configure web server

  1. yum -y install httpd mod_ssl
  2. service httpd start
  3. Edit iptables to allow incoming connections to port 80, 443
  4. service iptables restart
  5. Put test file in /var/www/html
  6. Open domain in browser to verify that website is accessible. (Wait at least 3-4 minutes after updating DNS entries to avoid getting wrong values cached in near-by DNS)
  7. chkconfig httpd on
  8. Edit /etc/httpd/conf/httpd.conf and update 'Listen 80' to 'Listen 0.0.0.0:80'


Create users

  1. useradd saurabh
  2. passwd saurabh

Similarly more users can be created


Setup postfix SMTP server

  1. Edit '/etc/postfix/main.cf' as follows:
    1. Set myhostname=mail.sbarjatiya.com
    2. Set mydomain=sbarjatiya.com
    3. Set myorigin=$mydomain
    4. Set inet_interfaces=all (Comment inet_interfaces=localhost)
    5. Prepend $mydomain to mydestination value (Without this only @mail.domain.com mails would get accepted. After this change @domain.com would also work)
  2. service postfix restart
  3. Edit /etc/sysconfig/network and set correct hostname.
  4. Edit /etc/hosts and correct hostname
  5. hostname mail.sbarjatiya.com
  6. Allow incoming connections to port 25 and 465


Setup dovecot

  1. yum -y install dovecot
  2. Edit /etc/postfix/main.cf and set 'home_mailbox = mail/'
  3. service postfix restart
  4. Edit /etc/dovecot/conf.d/10-mail.conf and set 'mail_location = maildir:~/mail'
  5. service dovecot start
  6. Allow incoming connections to ports 110,143,993,995
  7. chkconfig dovecot on


Setup squirrelmail

  1. yum -y install wget
  2. Setup rpmfusion, repoforge and epel
  3. yum -y install squirrelmail
  4. cd /usr/share/squirrelmail/config and run './conf.pl'
    1. Set Organization Preferences -> Organization name
    2. Set Server Settings -> Domain
    3. Set Server Settings -> IMAP Settings. Use values mail.sbarjatiya.com, 993, Secure (IMAP): true, Server software: dovecot
    4. Setup mail sending using sendmail and not through SMTP
  5. Open <domain>/webmail in browser
  6. setenforce 0
  7. edit /etc/sysconfig/selinux and set SELINUX=disabled

Note that user must login into squirrelmail interface once before he/she can receive email. This is required for creating necessary folders in home folder.


Squirrelamil change password support

  1. Download change_passwd and compatability (Version 1.3) plugins from
    http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fchange_passwd-4.0-1.2.8.tar.gz
    http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-1.3.tar.gz
  2. cd /usr/share/squirrelmail/plugins
  3. Extract both .tar.gz file here
  4. For change_passwd read INSTALL file and perform necessary steps
    1. cp config.php.sample config.php
    2. yum -y install gcc
    3. gcc -lcrypt -O -o chpasswd chpasswd.c
    4. chown root:apache chpasswd
    5. chmod 4750 chpasswd
  5. Go to /usr/share/squirrelmail/config
  6. Again run ./conf.pl and enable both plugins (Compatability plugin must load before change_password plugin. Edit /etc/squirrelmail/config.php by hand if that is not the case)



<yambe:breadcrumb>Email_server_configuration|Email server configuration</yambe:breadcrumb>