Development / Experimenting
August 5, 2019 ยท View on GitHub
If you'd like to contribute code to this project or give it a try locally (before deploying it), you need to:
-
clone this repository
-
get Docker and Docker Compose -- used for running a local Matrix Synapse + riot-web setup, for testing
-
start all dependency services (Postgres, Matrix Synapse, riot-web):
make services-start. You can stop them later withmake services-stopor tail their logs withmake services-tail-logs -
create a sample "sender" user:
make create-sample-sender-user -
create a sample "receiver" user:
make create-sample-receiver-user -
you should now be able to log in with user
receiverand passwordpasswordto the riot-web instance -
using riot-web, from that receiver (
receiver) user: create a room or two with thesenderuser (full Matrix user id is:@sender:email2matrix.127.0.0.1.xip.io) -
in another browser session (new container tab, private tab, another browser, etc.), log in to riot-web with user
senderand passwordpasswordand accept those room invitations -
copy the sample configuration:
cp config.json.dist config.json -
obtain an access token for the
senderuser usingmake obtain-sample-sender-access-token. You will need the value of theaccess_tokenfield below -
create a new mapping in
config.json(see the Configuration documentation)
Example:
{
"Mappings": [
{
"MailboxName": "test",
"MatrixRoomId": "!ROOM_ID_HERE:email2matrix.127.0.0.1.xip.io",
"MatrixHomeserverUrl": "http://synapse:8008",
"MatrixUserId": "@sender:email2matrix.127.0.0.1.xip.io",
"MatrixAccessToken": "SENDER_ACCESS_TOKEN_HERE",
"IgnoreSubject": false,
"IgnoreBody": false,
"SkipMarkdown": false
}
]
}
-
build and run the
email2matrixprogram by executing:make run-in-container -
send a test email by executing:
make send-sample-email-to-test-mailbox -
you should now see that email message relayed to the Matrix room created above
For local development, it's best to install a Go compiler (version 1.12 or later is required) locally.
Some tests are available and can be executed with: make test.