====== Snappy Mail ======
[[https://github.com/the-djmaze/snappymail|Snappy Mail]] is a simple, modern, lightweight & fast web-based email client. It is the successor of the long defunct RainLoop webmail client.
**Note:** i installed SnappyMail on my //external// server, together with the mail server, and not on the home server. The unusual approach you might note here are due to that noticeable differences.
===== Installation =====
Get your release [[https://github.com/the-djmaze/snappymail/releases|here]]
will install under /home/web/snappymail. Replace, in the following instruction, the URL and filename with the latest release:
mkdir -p /home/web/snappymail/frontend
cd /home/web/snappymail/frontend
wget https://github.com/the-djmaze/snappymail/releases/download/v2.38.2/snappymail-2.38.2.tar.gz
tar xvf snappymail-2.38.2.tar.gz
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
chown -R web:web data
==== Secure the data folder ====
Move the data folder //outside// the document root can be a good idea. First of all, move it physically:
cd /home/web/snappymail
mv frontend/data .
mv frontend/_include.php frontend/include.php
Now edit the file **frontend/include.php** and add setup the following line:
define('APP_DATA_FOLDER_PATH', '/home/web/snappymail/data/');
The trailing "/" is **very** important.
===== Reverse Proxy =====
server {
server_name webmail.mydomain.com;
listen 443 ssl;
index index.php;
root /home/web/snappymail/frontend;
access_log /var/log/nginx/webmail.mydomain.com_access_log main;
error_log /var/log/nginx/webmail.mydomain.com_error_log info;
location ~ /.*\.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
# Security headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Robots-Tag "none" always;
add_header X-Download-Options "noopen" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header Referrer-Policy "no-referrer" always;
add_header X-Frame-Options "SAMEORIGIN" always;
fastcgi_hide_header X-Powered-By;
index index.php;
location ~ (^|/)\. {
return 403;
}
location ~ ^/data/ {
deny all;
}
}
===== Configuration =====
After restarting NGINX, go to **https://webmail.mydomain.com/?admin**, you need to login as user **admin** with the password found in the file: //data/_data_/_default_/admin_password.txt//.
Immediately change the password, and that file will be deleted.
You need to setup the domains you want to use in SnappyMail to allow users to login.
===== Upgrade =====
To upgrade the installation, you simply need to upload files from the new package overwriting existing files. Directory structure is organized to have each new version installed to a different directory. Only a few files will be actually overwritten (/index.php and /data/VERSION).
All the additional reconfiguration will be done by the product on next run.
Then when everything works, you may remove any old version that resides in /snappymail/v/.