Skip to content

Gateway-server from SMTP to RocketChat: Send an e-mail directly to a specific RocketChat-user or room/channel

License

Notifications You must be signed in to change notification settings

glasen/rocketgateway

Repository files navigation

RocketGateway

I had originally developed this program for internal use in my company. Since we set up our internal network with no internet access, I needed an easy way to receive status emails from servers e.g. TrueNAS. Since I didn't want to maintain an email server only for status messages, it was obvious to use our internal RocketChat server to receive these emails.

Unfortunately there was no software available that allowed to send an email directly to RocketChat. All programs on the market use a normal email server as an intermediate step.

For this reason I developed this small program which provides a SMTP-to-RocketChat-gateway. You can simply send an e-mail to a specific user (The e-mail address must be provided for each user account) and he will get a message directly in RocketChat. Attachments in the email are converted to file uploads in RocketChat. Since RocketChat, for security reasons, does not support HTML-rendering, HTML-emails are converted into Markdown-format.

How to use the program

The program needs an installation of RocketChat-server and at least Java 21 to compile it.

In RocketChat you must create a user which is in the "bot"-group e.g. "email-bot" which is then used by RocketGateway to send messages. You also must add the permission "View Full Other User Info" to the bot-group, otherwise RocketGateway cannot map the e-mail-address to the internal user id of RocketChat.

For security reasons you should generate a new permissions-group and clone every permission from the original "bot"-group and then add "View Full Other User Info" to this group. The credentials of the newly generated user must then be added to the "rocketgateway.json"-file.

You can also activate SMTP-authentication (username and password) and TLS-encryption (1.3 and 1.2) for the SMTP-connection. I've tested the TLS-encryption with the "Let's Encrypt"-certificates of my own root-server. If you want to enable TLS, ensure that all paths to the certificate files are correct.

The json-config file in the dist-directory should be self-explaining and the default configuration should work with a normal RocketChat-installation on the same server.

Installation

Just download the tar-file, unpack it and start the bash-script:

./rocketgateway.sh -c rocketgateway.json

Compilation

./gradlew build

About

Gateway-server from SMTP to RocketChat: Send an e-mail directly to a specific RocketChat-user or room/channel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages