Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server
From Notes_Wiki
<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
- Create a dedicated amazon account
- Create CentOS micro instance with public IP
- Take an elastic IP and associate with VM
- Ensure that security group of VM allows SSH, HTTP, HTTPS, IMAP, IMAPS, SMTP, STMPS, POP3, POP3S and ICMP
- Register domain name through registrar such as godaddy
- Update DNS entries for domain, www, mail, MX record to point to elastic IP of the VM
Configure web server
- yum -y install httpd mod_ssl
- service httpd start
- Edit iptables to allow incoming connections to port 80, 443
- service iptables restart
- Put test file in /var/www/html
- 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)
- chkconfig httpd on
- Edit /etc/httpd/conf/httpd.conf and update 'Listen 80' to 'Listen 0.0.0.0:80'
Create users
- useradd saurabh
- passwd saurabh
Similarly more users can be created
Setup postfix SMTP server
- Edit '/etc/postfix/main.cf' as follows:
- Set myhostname=mail.sbarjatiya.com
- Set mydomain=sbarjatiya.com
- Set myorigin=$mydomain
- Set inet_interfaces=all (Comment inet_interfaces=localhost)
- Prepend $mydomain to mydestination value (Without this only @mail.domain.com mails would get accepted. After this change @domain.com would also work)
- service postfix restart
- Edit /etc/sysconfig/network and set correct hostname.
- Edit /etc/hosts and correct hostname
- hostname mail.sbarjatiya.com
- Allow incoming connections to port 25 and 465
Setup dovecot
- yum -y install dovecot
- Edit /etc/postfix/main.cf and set 'home_mailbox = mail/'
- service postfix restart
- Edit /etc/dovecot/conf.d/10-mail.conf and set 'mail_location = maildir:~/mail'
- service dovecot start
- Allow incoming connections to ports 110,143,993,995
- chkconfig dovecot on
Setup squirrelmail
- yum -y install wget
- Setup rpmfusion, repoforge and epel
- yum -y install squirrelmail
- cd /usr/share/squirrelmail/config and run './conf.pl'
- Set Organization Preferences -> Organization name
- Set Server Settings -> Domain
- Set Server Settings -> IMAP Settings. Use values mail.sbarjatiya.com, 993, Secure (IMAP): true, Server software: dovecot
- Setup mail sending using sendmail and not through SMTP
- Open <domain>/webmail in browser
- setenforce 0
- 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
- Download change_passwd and compatability (Version 1.3) plugins from
- cd /usr/share/squirrelmail/plugins
- Extract both .tar.gz file here
- For change_passwd read INSTALL file and perform necessary steps
- cp config.php.sample config.php
- yum -y install gcc
- gcc -lcrypt -O -o chpasswd chpasswd.c
- chown root:apache chpasswd
- chmod 4750 chpasswd
- Go to /usr/share/squirrelmail/config
- 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>