You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jojii daa0ae3155
Merge pull request #47 from S0urC10ud/patch-1
11 months ago
main code style improvements 1 year ago
.gitignore Modify to make it work with mautrix-go v0.8.0 1 year ago
Dockerfile update Dockerfile 1 year ago
LICENSE Create LICENSE 3 years ago CURL-access-token-command: multi-line comment 11 months ago


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.


Compile method

git clone
cd Matrix-EmailBridge/main
go get -v -u
go build -o emailbridge

The last command executes the bridge once to create the probably missing config file.
Continue: --> Configure

Docker method



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 \

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!

Get started

  1. Create a bot user.
  2. Get an access token to your Matrix-Server:
curl -XPOST -d '{"type":"m.login.password", "user":"", "password":"mailbotPassword"}' ""
  1. Adjust the config file (cfg.json) to make it work with your matrix server:
  "allowed_servers": [
  "defaultmailcheckinterval": 30,
  "htmldefault": false,
  "markdownenabledbydefault": true,
  "matrixaccesstoken": "access-token-from-step-3",
  "matrixserver": "",
  "matrixuserid": ""
  1. Invite your bot into a private room, it will join automatically.

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.


  • Receiving Email with IMAPs
  • Use custom IMAPs Server and port
  • Use the bridge with multiple email addresses
  • Use the bridge with multiple user
  • Ignore SSL certs if required
  • Detailed error codes/logging
  • Use custom mailbox instead of INBOX
  • Sending emails (to one or multiple participants)
  • Use markdown (automatically translated to HTML) for writing emails (optional)
  • Viewing HTML messages (as good as your matrix-client supports html)
  • Attaching files sent into the bridged room
  • Emailaddress blocklist (Ignore emails from given emailaddress)


  • System to send passwords not in plaintext
  • Add more header (CC/Bcc)
  • Update the installerscript