A Matrix-bridge to allow you receiving and sending emails in Matrix. You can have multiple email accounts and write emails to one or multiple recipients.
git clone https://github.com/JojiiOfficial/Matrix-EmailBridge
cd Matrix-EmailBridge/main
go get -v -u
go build -o emailbridge
./emailbridge
The last command executes the bridge once to create the probably missing config file.
Continue: --> Configure
DockerHub: https://hub.docker.com/r/jojii/matrix_email_bridge
Run
docker pull jojii/matrix_email_bridge
to pull the image. Then create a container by running
docker run -d \
--restart unless-stopped \
-v `pwd`/data:/app/data \
--name email_bridge \
jojii/matrix_email_bridge
This will create and start a new Docker Container and create a new dir called 'data' in the current directory. In this folder data.db, cfg.json and the logs will be stored.
After configuring the bridge you have to run
docker start email_bridge
to start the docker container again.
Note: 'localhost' as 'matrixserver' (in cfg.json) wouldn't work because of dockers own network. You have to specify the internal IP address of the matrix-synapse server!
curl -XPOST -d '{"type":"m.login.password", "user":"@mailBotUsername:your-domain.com", "password":"mailbotPassword"}' "https://matrix.your-domain.com/_matrix/client/r0/login"
{
"allowed_servers": [
"your-base-domain.com"
],
"defaultmailcheckinterval": 30,
"htmldefault": false,
"markdownenabledbydefault": true,
"matrixaccesstoken": "access-token-from-step-3",
"matrixserver": "matrix.full-matrix-server-domain.com",
"matrixuserid": "@mailBotUsername:your-base-domain.com"
}
If everything is set up correctly, you can bridge the room by typing !login
. Then you just have to follow the instructions. The command !help
shows a list with available commands.
Creating new private rooms with the bridge lets you add multiple email accounts.
Note: you should change the permissions of the cfg.json
and data.db
to 640 or 660 because they contain sensitive data.