Email This List Email This List Print This List Print This List

Set web­mail access with Ajenti — Rain­loop

Intro­duc­tion

Rain­Loop is a free email cli­ent that can access any IMAP/​SMTP emails, includ­ing Ajenti V’s built-in email. It sup­ports mul­tiple accounts, social logins (log in with Twit­ter, Face­book, etc.), two factor authen­tic­a­tion, and more. Rain­Loop is a great pro­gram to install with Ajenti V because the Ajenti V plat­form itself has no default web­mail.

Screenshot of Rainloop

At the end of this tutori­al we will have Rain­Loop installed on mail.example.com with IMAP/​SMTP access to mail­boxes on example.com.

Pre­requis­ites

Step 1 — Cre­at­ing the Rain­Loop Web­site in Ajenti V

In your browser, browse to your Ajenti con­trol pan­el (usu­ally loc­ated at https://panel.example.com/), and log in. In the side­bar to the right, under the Web sec­tion, click Web­sites.

Under the New Web­site sec­tion there is a Name text field. Type RainLoop and click the Cre­ate but­ton. Under the Web­sites sec­tion on that same page, click Man­age on the new RainLoop line.

On the page that appears, uncheck the box next to Main­ten­ance mode. In the Web­site Files sec­tion below that, change Path from /srv/new-website to /srv/RainLoop. Press the Set but­ton next to that text field. Then press the Cre­ate Dir­ect­ory but­ton below that. Click Apply Changes at the bot­tom of the screen.

On the top of the page, click the Domains tab. Click Add and replace example.com withmail.example.com, repla­cing example​.com with your domain name. Click Apply Changes at the bot­tom of the screen.

Rain­Loop is PHP-based, so now we need to enable PHP for the Rain­Loop web­site we are cre­at­ing. Click the Con­tent tab. Change the drop­down box to PHP FastCGI, and click Cre­ate.

Now click the Advanced tab. In the Cus­tom Con­fig­ur­a­tion box, enter:

location ^~ /data {
  deny all;
}

This addi­tion denies web access to inform­a­tion stored in the /data dir­ect­ory.

Click Apply Changes at the bot­tom of the screen. Con­fig­ur­a­tion should now be com­plete. The next step is to install Rain­Loop.

Step 2 — Installing Rain­Loop

In the Ajenti side­bar, under the Tools sec­tion, click Ter­min­al. Click the New but­ton at the top of the screen, then click the black box that appears.

Note: All com­mands here are run as root.

At the ter­min­al prompt, type:

  • cd /​srv/​RainLoop

Press ENTER. Then, type the fol­low­ing to install some soft­ware depend­en­cies:

  • apt-get install php5-cli php5-curl

Press ENTER to start the install­a­tion pro­cess. Press Y if promp­ted. Finally, enter the fol­low­ing to install Rain­Loop:

  • wget ‑qO- http://​repos​it​ory​.rain​loop​.net/​i​n​s​t​a​l​l​e​r​.​php | php

Press ENTER. This com­mand extracts all Rain­Loop files and installs them on the serv­er.

Now we should set the cor­rect per­mis­sions for the files and make them owned by the cor­rect user. Enter these com­mands in the same ter­min­al, press­ing ENTER after each one:

find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
chown -R www-data:www-data .

Now that all the files and dir­ect­or­ies are setup, you can press the X on the Ter­min­al 0 tab to leave the ter­min­al.

Step 3 — Chan­ging the Admin Pass­word

Browse to http://mail.example.com/?admin in your web browser, repla­cing example​.com with your domain name. The default user­name is admin, and the default pass­word is 12345. Log in with those cre­den­tials.

When you login for the first time, you will be greeted with a warn­ing:

Warning shown in RainLoop after installation

The change word in the warn­ing is a link. Click it, and change the admin pass­word to make your install­a­tion more secure. Click Update Pass­word to fin­ish chan­ging it. The but­ton will turn green, sig­ni­fy­ing your change was accep­ted.

Step 4 — Set­ting Up Your Domain

In the side­bar of Rain­Loop, click Login. In the Default Domain text field, you should enter the domain that comes after the @ in your Ajenti V email (usu­ally this is your registered domain name). Press ENTER, and a green check mark will appear tem­por­ar­ily, show­ing it’s saved.

In the side­bar, now click Domains. There is a list of default email domains already added. This list includes com­mer­cial domains such as gmail.com, outlook.com, qq.com, and yahoo.com. If you have an account with one of those ser­vices and you would like to be able to check them with­in Rain­Loop, you can leave them. Oth­er­wise, you can click the trash can icon next to them to remove them.

Now, click Add Domain at the top of that page. In the Name field, enter your domain name such asexample.com. Under the IMAP sec­tion, below Serv­er, enter mail.your_domain_name. Under Secure, use the drop­down to select STARTTLS. Now under the SMTP sec­tion, below Serv­er entermail.your_domain_name.

Example configuration

At the bot­tom of this screen click the Test but­ton. If it turns green, click the Add but­ton at the bot­tom of the mod­al to add your domain. If it turns red, read the error mes­sages to fig­ure out why it can­’t con­nect.

Step 5 — Enabling Two Factor Authen­tic­a­tion (Option­al)

If you use a ser­vice like Google Authen­tic­at­or or Authy, this sec­tion may be of interest to you.

Browse to the Secur­ity option in the side­bar. Check the box next to Allow 2‑Step Veri­fic­a­tion. Option­ally, you can check the box next to Enforce 2‑Step Veri­fic­a­tion as well, but this isn’t neces­sary unless you have mul­tiple users using this and you want them all to be forced to use Two Factor Authen­tic­a­tion.

Enabling 2FA

You will learn how to con­fig­ure Two Factor Authen­tic­a­tion later in this tutori­al.

Step 6 — Log­ging in to Rain­Loop

Browse to http://mail.your_domain_name. Enter your entire email address (not just your user­name) in the first box and your email pass­word in the next. This is not your admin login. Rather, it is the account inform­a­tion you spe­cified when set­ting up your mail­box in Ajenti. Check the Remem­ber Me box if you do not want to have to log in every time you vis­it Rain­Loop on your com­puter.

Once you login, you should be done! You can now read your email mes­sages and com­pose. You can choose to fin­ish here or con­tin­ue with some option­al set­tings.

Step 7 — Cus­tom­iz­ing Rain­Loop (Option­al)

At the top of the page, click the drop­down but­ton with the sil­hou­ette per­son icon.

Profile Menu

Click Set­tings. In the first screen that shows up, you will have the option to con­fig­ure gen­er­al details to your lik­ing. You can choose between ver­tic­al and hori­zont­al lay­outs, the default text edit­or, etc.

One option that may be use­ful is the Noti­fic­a­tions options. If this is your primary email cli­ent, you might want to enable noti­fic­a­tions upon email arrival. Just check both boxes under the Noti­fic­a­tions sec­tion to start get­ting popups from your browser when you receive an email:

Email notification popup

As you can see, it shows who sent the email and the sub­ject line. Simply click it to read the full mes­sage in your browser. Rain­Loop will need to be open in a browser tab at all times for this to work.

Step 8 — Set­ting Up Two Factor Authen­tic­a­tion (Option­al)

If you would like to set up Two Factor Authen­tic­a­tion, fol­low these steps. Log into the Rain­Loop user inter­face at http://mail.your_domain_name and go to Set­tings. In Set­tings, click Secur­ity in the side­bar. There should be a link titled Con­fig­ur­ate 2‑Step Authen­tic­a­tion. Click it, and click the Activ­ate but­ton that appears.

2FA Setup

Note: The fol­low­ing screen­shots are for Google Authen­tic­at­or. The steps for your authen­tic­a­tion app may vary.

In Google Authen­tic­at­or, under Manu­ally Activ­ate an Account, click Scan a bar­code. You may be promp­ted to install a bar­code scan­ner app. If so, install it and return to the app.

Scan a Barcode

Now scan the QR code dis­played on the webpage.

Scan the code

There should now be a six-digit code dis­played on your phone. You will need this code to sign into your web­mail.

2FA on Phone

Back in the Two Factor Authen­tic­a­tion mod­al on your com­puter, next to Enable 2‑step veri­fic­a­tion at the top, there will be a link that says test. Click it, enter the 6‑digit code on your phone, and press ENTER. If the but­ton turns green, click the X on that win­dow, and check the box next to Enable 2‑Step veri­fic­a­tion. Then press Done at the bot­tom of the screen.

From now on, every time you sign into Rain­Loop, you will need to look­up the six-digit code in Google Authen­tic­at­or and enter it along with your user­name and pass­word com­bin­a­tion.

2FA login

Writ­ing an Email

Back at the homepage of Rain­Loop, where you can view your emails, there is an icon of a paper air­plane in the top left corner of the page. Simply click it and the com­pose email mod­al box will appear, allow­ing you to write an email.

Compose email modal

When you fin­ish, click Send, and your email will be sent to its recip­i­ent.

Con­clu­sion

Rain­Loop should now be installed on your serv­er, grant­ing easy email account access to your mail­boxes from any web browser.

Related Post

admin has written 133 articles