Official website for Linux User & Developer
FOLLOW US ON:
May
10

Webmail server tutorial

Posted by Rob Zwetsloot

Cut out the middleman by managing your own webmail for personal accounts and avoid any unnecessary downtime

While using webmail may be incredibly convenient, you’re also at the mercy of another company’s server and privacy policies. With the way that people are connected online today it’s almost impossible to go back to the mail client system of old, even if security and privacy are far superior to Gmail.

But there is another solution that satisfies both requirements; by hosting your very own webmail server you can have both the convenience of worldwide access while having the privacy of a desktop mail client. By using Rainloop, you can quickly and easily set up your own webmail server with your own custom settings and email addresses.

You will need a server or always-on PC in order to host your webmail, otherwise it will only work when your computer is actually on. Be aware that it may also increase your bandwidth usage on a monthly basis, so don’t send huge files over it unless you need to. Interested? Let’s get going.

The final result
The final result

Resources

Rainloop
A server

Step-by-step

Step 01 Server ready

Before we even begin to look at Rainloop in depth, we need to make sure the system hosting it is server ready. Install the following packages from the terminal:

$ sudo apt-get install apache2 php5 php5-mysql libmysqlclient15-dev mysql- server poppassd

Some or most of these packages may already be installed, but it’s worth checking.

Step 02 Set up directories

We’ll need specific directories created to get Rainloop to work. You can do this in a file manager, but it works in the command line like so:

$ sudo mkdir /var/www/webmail

Move to the directory for the next step, as this is where all our Rainloop files will live.

Step 03 Download Rainloop

Now it’s time to get Rainloop. If you have a graphical interface, download the latest version of Rainloop from the website and unzip it. Otherwise, use wget to download it:

$ wget http://repository.rainloop.net/v1/ rainloop-[current version].zip

And then unzip it to proceed.

Step 04 Elevate permissions

Open the terminal if it’s not already and use cd to move to /var/www/webmail. Run the following two commands to elevate the permissions of the necessary files:

 $sudo find . -type d -exec chmod 755 {} \;
$ sudo find . -type f -exec chmod 644 {} \;

Step 05 Final permissions

Finish off making sure all the permissions are set by running:

$ sudo chown -R www-data:www-data /var/www/webmail

Rainloop is now just about ready to go, and most of the rest of the setup will occur within the interface itself.

Step 06 Access Rainloop

Now what we have to do is log into Rainloop from a browser; you do this either through the IP of the server or its web domain if you know it. If you’re accessing it on a local machine, use 127.0.0.1. Enter the following into your address bar:

http://[IP address or domain]/ webmail/?admin

Step 07 Log in

The username and password for this default version of Rainloop is ‘admin’ and 12345 respectively. Log in to access the interface; our first task is to then change the default password. Create a secure password using standard password etiquette, as the URL is quite common.

Step 08 Add domains

In the Admin Panel, find domains and then add a domain. Here you can add your own personal email or work domains and use the IP or server address in either or both of the IMAP and SMTP fields. You don’t need to add Gmail or a handful of other web services, as they’re already listed.

Step 09 Domain ports

Make sure the ports are correct on the server addresses: for a local server, the default ports should be fine. Also, make sure that ‘Use short login form’ is checked, name the server as the @ address of your email (eg example.com) and then click Add to save it to the list.

Step 10 Contacts database

To support contacts, we need to add a MySQL database. Open up the terminal again and type in:

$ sudo mysql -u root -p

Enter your password and you’ll be dropped into the MySQL shell to create the database.

Step 11 Create the database

To create our contacts database, enter the following command:

create database rainloop;

This, as you might have guessed, simply creates the database named rainloop. To confirm the operation and quit out of the MySQL shell use: exit;

Step 12 Enable Contacts

Back in the admin panel on Rainloop, go to the Contacts tab and check the Enable Contacts box. Below that, change the type of the database to MySQL. You’ll then also need to add the username and password for the MySQL server.

Step 13 Password changing plug-in

You’ll need to add a specific password change plug-in to be able to change any passwords on a Linux mail-server. To do this, open up the terminal and first install the plug-in toyoursystemwith:

$ sudo apt-get install poppassd

Step 14 Activate password plug-in

Now you need to add the plug-in on the admin panel of Rainloop. Go to the packages tab and find the plug-in on the list; activate it by clicking the arrow next to release date.

Step 15 Log in to your email

To log in to your webmail, go to the webmail address for your server:

http://[IP or domain]/webmail

And use your normal login details for the mail address you’ve added to the server. It will log you in and work just like any email client, with a column of emails on the left and a preview pane located on the right. You can then expand the emails to take up fullscreen.

Rainloop will remember which emails you have read and connect to drafts and sent folders whenever you log in.

Step 16 Add a signature

Click on the gear symbol at the bottom to accesstheSettings.Fromhereyoucancreatean identity, each with an individual signature. This is useful for if you’re using multiple accounts, or if multiple people using the same email.

Step 17 Add extra folders

Located next to the settings cog on the main screen is the new folder button. You can add folders and then move emails to them for better filing, and these will sync with the server. You can also have parents and children of folders in your hierarchy

Step 18 Manage folders

In settings you can create folders, but you can also delete, hide and edit the folders too. There’s also an option to change the system folders, allowing you to filter spam, sent or other types of messages to pre-determined folders. This is currently the only way to filter email.

Step 19 Connect via social media

Rainloop has an interesting feature of allowing you to log in to your webmail for specific accounts via Twitter, Facebook or Google sign in. Before you have a go at this, make sure that you’re signed in with the webmail account you want to activate this on.

Step 20 Choose your account

Once you’re logged in, go to the Settings menu and locate the Social tab. In here you can choose between the three social media types – you basically need to log in under one or all of them here first before adding the feature to the main interface.

Step 21 Add a new account

You can add another account to your login for that email address, as long as it’s included in the accounts you have created on the admin page. This way you can consolidate all of your emails into one single login. This can be done from the main page, or more preferably from the Accounts tab in the Settings menu.

Step 22 More on social

Having your social media work as a log on means that you can only use them on the one account that you’ve set them up for. It also means that people can more easily log in to your accounts if they have access to your regular system and you don’t log out.

Step 23 More to come

There are some features missing at the moment that you might miss from some regular clients – Out Of Office messages and automatic filters, for example. These features will eventually come, whether officially or via plug-ins, so keep an eye out for updates.

Tags: ,
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • Mwamba Natanga

      No PGP signatures/encryption?

    • Tony Bronze

      This line screwed up all the permissions for var:

      $ sudo chown -R www-data:www-data /var/ www/webmail

      should it not be

      $ sudo chown -R www-data:www-data /var/www/webmail

      i.e. without the gap between /var/ and www/webmail?