📧 💾 Create Server Mail on Ubuntu 📀 📩

in #linux7 years ago (edited)

To configure a full server Mail on Ubuntu we need: Postfix Mail Server, Dovecot and Squirrelmail (Webmail).

The virtual email system consists of:
-SMTP Server (MTA) Postfix
-IMAP Server and POP Dovecot
-SMTP Auth Extension (SASL) for user authentication in order to accept delivery mail (relaying)
-SMTP and Pop/Imap communication with SSL/TLS
-Users and virtual domains are saved in a MYSQL database.

1. First step is to install Apache2 and PHP5:

b94d9f4c-3bf5-4109-af1d-af91ea8d875a.jpg
*Photo from Google.

Apache is an open source HTTP server. It supports a wide variety of modules. Some supported languages are: Mod_perl, Mod_python, Mod_SSL, TCL and PHP. Another quality of the Apache server is virtual hosting, which consists of the possibility to host multiple sites simultaneously on the same server.

PHP: Hypertext Preprocessor - is a general-purpose, open source Code scripting language, which is especially suitable for web application development and can be integrated into HTML.

For installing Apache2 and PHP5 we need to run from the Terminal console the following commands:

$ sudo apt-get update
$ sudo apt-get install apache2 php5

2. Install Postfix Mail Server

Next step is to install Postfix Mail Server.
Postfix is a mail transfer agent - MTA, who is responsible for sending and receiving mails.

You must also set firewall access to the following ports:
SMTP: 25
POP3: 110
IMAP: 143
SMTP Secure: 465
MSA: 587
IMAP Secure: 993
POP3 Secure: 995

From the Terminal we need to run the following command:

$ sudo apt-get install postfix

Untitled.jpg

During installation, simply accept all of the defaults at each prompt to complete the process.

After the installation, run the following command to configure Postfix:

$ sudo dpkg-reconfigure postfix

And enter the following values:


1. Internet Site.
2. System Mail Name: your.domanin
3. Root and postmaster mail recipient: root
4. Other destinations for mail: $myhostname, your.domain, localhost.your.domain, localhost, mail.your.domain
5. Force synchronous updates on mail queue?: NO
6. Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
7. Mailbox size limit (bytes): 0
8. Local address extension character: +
9. Internet protocols to use: all

Next, we adjust some settings:

We set the home_mailbox variable to Maildir/. Configure home_mailbox and set the location of the virtual_alias_maps table by typing:

$ sudo postconf -e 'home_mailbox= Maildir/'
$ sudo postconf -e 'virtual_alias_maps= hash:/etc/postfix/virtual'

Nextstep is to edit the virtual maps file:

$ sudo nano /etc/postfix/virtual

Put in the file the following line and save:
[email protected]

Restart Postfix to save the changes:

$ sudo systemctl restart postfix

3. Install Dovecot

Step 3 is to install Dovecot.

Dovecot is an IMAP and POP3 email server for Linux who uses very little memory.

Run from Terminal the following command:

$ sudo apt-get install dovecot-core dovecot-imapd

Set permissions on the /var/mail:

$ sudo chmod 777 /var/mail

4. Install Squirrelmail

Step 4 is to install Squirrelmail.

Untitle9d.png

SquirrelMail is a webmail service written in PHP. Supports IMAP and SMTP protocols. Does not require very many resources and is very easy to install.

To install it run in Terminal the following command:

$ sudo apt-get install squirrelmail

Edit Apache configurations

$ sudo nano /etc/apache2/sites-available/example.com.conf

in VirtualHost to add an alias for Squirrelmail:

...
<VirtualHost *:80>
ServerName your.domain

Alias /squirrelmail /usr/share/squirrelmail
...

Save and restart Apache:

$ sudo systemctl restart apache2

After restart, open in browser: your.domain/squirrelmail

Thanks for reading. Stay close for more !

Sort:  

As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!

Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase https://
3. Type re
Get Featured Instantly & Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness

For webmail I use roundcubemail, more beauty and easy to use !

Indeed Roudcube is easier to use. I tried him and also Horde. They're all very good.

Coin Marketplace

STEEM 0.25
TRX 0.21
JST 0.036
BTC 97583.14
ETH 3481.73
USDT 1.00
SBD 3.45