First class email bridge for Matrix.
This bridge enables Email users and Matrix users to communicate back and forth.
This was made during Google Summer of Code 2021
To set up the bridge, simply clone this repository.
git clone https://github.com/abbyck/matrix-appservice-email.git
- Install the dependencies
cd matrix-appservice-email && npm i
- Generate the Application Service registration file with
node app.js -r -u "http://localhost:8090" -f /config/email-registration.yaml
(http://localhost:8090 is the URL that the AS will listen to. - Add the registration details to your homeserver configuration by adding the
email-registration.yaml
. - Make a copy of the sample
config/config-sample.yaml
and carefully change the options as required. - Run the bridge!
node app.js -c config/config.yaml
Most of the available options are detailed on the sample configuration file.
It's highly recommended to use the following settings to ensure email delivery.
- Correct MX records and SPF records.
- DKIM (DomainKeys Identified Mail).
- You may use opendkim-genkey to generate the DKIM keys.
- TLS Keys for encrypted outbounds to supported servers.
A Dockerfile is included. To use it:
# To build a docker image
docker build . -t matrix-appservice-email
# Create a new config file
mkdir data
cp config/config.yaml data/config.yaml
# ...and edit that file.
# Generate a registration file
docker run --rm -v $PWD/data:/config matrix-appservice-email node app.js -r -u "http://localhost:8090" -f /config/email-registration.yaml
# To run with default ports (port 25 for SMTP, port 8090 for bridge traffic)
docker run --rm -v $PWD/data:/config matrix-appservice-email
# To run with custom ports
docker run --rm -v $PWD/data:/config -p 127.0.0.1:25:1111/tcp -p 127.0.0.1:8090:2222/tcp matrix-appservice-email
- Email users can join public Matrix rooms which has room aliases.
- To join a room, send an email to
[email protected]
and the user would be automatically joined to a matrix room#test:example.com
- To join a room, send an email to
- To Direct message a user on the matrix side, hit a mail to
[email protected]
and a DM will be created with the user@alice:example.com
- Subsequent replies will be sent to the
from
address.
- Subsequent replies will be sent to the
- They can send and receive messages to Matrix rooms.
- Outbound mails have the ability to get DKIM signed and,
- Use TLS while communicating with supported mail servers (Configuration required).
- Inbound spam protection: Running an email server publicly means, you have to fight a lot of spam
- Attachments/File Handling
See something missing? Hit a message to @abbyck:matrix.org.