Skip to content

Self-host an encrypted mailbox with your own domain name

Notifications You must be signed in to change notification settings

krm35/encrypted-mailbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MAILBOX: Self-host an encrypted mailbox with your own domain name

To start a dev server

Start redis redis-server --save "" --appendonly no

Start mongodb mongod --dbpath /tmp

Go to back & front directories and type npm install npm run dev

To start a production server

Build static files cd front && npm install && npm run build

Install redis sudo apt-get install redis

Install mongodb sudo apt-get install mongodb-server

Install back-end dependencies cd back && npm install

Create a secrets.json file in the back directory

{
  "domain": "@yourdomain.yourextension",
  "domains": ["@yourdomain2.yourextension"],
  "sendmailConf": {
    "silent": true,
    "dkim": {
        privateKey: "optional - path of your private key file",
        keySelector: 'optional - domainkey'
    }
  },
  "host": "Your Server IP",
  "smtpPort": 25,
  "httpPort": 443,
  "ssl": true,
  "sslKey": "path to key for both servers",
  "sslCert": "path to cert for both servers",
  "sslHttp": true,
  "sslKeyHttp": "path to key if ssl for http",
  "sslCertHttp": "path to cert if ssl for http",
  "sslSmtp": true,
  "sslKeySmtp": "path to key if ssl for smtp",
  "sslCertSmtp": "path to cert if ssl for smtp",
  "attachments": "optional - path to the attachments directory",
  "allowNonAdminSignUp": "boolean true by default -> anyone can sign up",
  "enableQueue": "boolean true by default -> enable the queue to send email from no-reply@yourdomain",
  "enableQueueLogs": "boolean true by default -> enable the queue logs and save them into mongo,
  "gridfs": "boolean true by default -> Save attachments in mongodb"
}

Create a service

nano mailbox-daemon.service

[Unit]
Description=Start mailbox

[Service]
WorkingDirectory=/home/YOURUSER/mailbox/back
ExecStart=node index.js
Restart=always
RestartSec=5000ms

SyslogIdentifier= mailbox-daemon

[Install]
WantedBy=default.target

sudo cp mailbox-daemon.service /etc/systemd/system/

sudo systemctl enable mailbox-daemon

sudo systemctl start mailbox-daemon