fda0d62087ae9d54876eef4bc4031d4c248158c0
Postmoogle 

An Email to Matrix bridge. 1 room = 1 mailbox.
Postmoogle is an actual SMTP server that allows you to receive emails on your matrix server. It can't be used with arbitrary email providers, but setup your own provider "with matrix interface" instead.
Roadmap
Receive
- SMTP server
- Matrix bot
- Configuration in room's account data
- Receive emails to matrix rooms
- Receive attachments
- Map email threads to matrix threads
Send
- SMTP client
- Send a message to matrix room with special format to send a new email
- Reply to matrix thread sends reply into email thread
Configuration
1. Bot (mandatory)
env vars
- POSTMOOGLE_HOMESERVER - homeserver url, eg:
https://matrix.example.com - POSTMOOGLE_LOGIN - user login/localpart, eg:
moogle - POSTMOOGLE_PASSWORD - user password
- POSTMOOGLE_DOMAIN - SMTP domain to listen for new emails
- POSTMOOGLE_PORT - SMTP port to listen for new emails
other optional config parameters
- POSTMOOGLE_NOENCRYPTION - disable encryption support
- POSTMOOGLE_STATUSMSG - presence status message
- POSTMOOGLE_SENTRY_DSN - sentry DSN
- POSTMOOGLE_LOGLEVEL - log level
- POSTMOOGLE_DB_DSN - database connection string
- POSTMOOGLE_DB_DIALECT - database dialect (postgres, sqlite3)
- POSTMOOGLE_MAXSIZE - max email size (including attachments) in megabytes
- POSTMOOGLE_ADMINS - a space-separated list of admin users. See
POSTMOOGLE_USERSfor syntax examples
You can find default values in config/defaults.go
2. DNS (optional)
The following configuration needed only if you want to send emails using postmoogle
First, add new DMARC DNS record of TXT type for subdomain _dmarc with a proper policy, the easiest one is: v=DMARC1; p=quarantine;.
Example
$ dig txt _dmarc.DOMAIN
; <<>> DiG 9.18.6 <<>> txt _dmarc.DOMAIN
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57306
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;_dmarc.DOMAIN. IN TXT
;; ANSWER SECTION:
_dmarc.DOMAIN. 1799 IN TXT "v=DMARC1; p=quarantine;"
;; Query time: 46 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Sun Sep 04 21:31:30 EEST 2022
;; MSG SIZE rcvd: 79
Second, add new SPF DNS record of TXT type for your domain that will be used with postmoogle, with format: v=spf1 ip4:SERVER_IP -all
Example
$ dig txt DOMAIN
; <<>> DiG 9.18.6 <<>> txt DOMAIN
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24796
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;DOMAIN. IN TXT
;; ANSWER SECTION:
DOMAIN. 1799 IN TXT "v=spf1 ip4:111.111.111.111 -all"
;; Query time: 36 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Sun Sep 04 21:35:04 EEST 2022
;; MSG SIZE rcvd: 255
Usage
How to start
- Invite the bot into a room you want to use as mailbox
- Read the bot's introduction
- Set mailbox using
!pm mailbox NAMEwhereNAMEis part of email (e.g.NAME@example.com) - Done. Mailbox owner and other options will be set automatically when you configure mailbox.
If you want to change them - check available options in the help message (
!pm help)
Full list of available commands
- !pm help - Show help message
- !pm stop - Disable bridge for the room and clear all configuration
- !pm mailbox - Get or set mailbox of the room
- !pm owner - Get or set owner of the room
- !pm nosender - Get or set
nosenderof the room (true- hide email sender;false- show email sender) - !pm nosubject - Get or set
nosubjectof the room (true- hide email subject;false- show email subject) - !pm nohtml - Get or set
nohtmlof the room (true- ignore HTML in email;false- parse HTML in emails) - !pm nothreads - Get or set
nothreadsof the room (true- ignore email threads;false- convert email threads into matrix threads) - !pm nofiles - Get or set
nofilesof the room (true- ignore email attachments;false- upload email attachments)
- !pm mailboxes - Show the list of all mailboxes
- !pm users - Get or set allowed users patterns
- !pm delete <mailbox> - Delete specific mailbox
Where to get
Description
Languages
Go
98.6%
Just
1.1%
Dockerfile
0.2%