{"id":14483382,"url":"https://github.com/discourse/mail-receiver","last_synced_at":"2025-04-13T08:40:57.951Z","repository":{"id":45569697,"uuid":"126848572","full_name":"discourse/mail-receiver","owner":"discourse","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T22:29:23.000Z","size":99,"stargazers_count":10,"open_issues_count":3,"forks_count":13,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-27T00:13:47.022Z","etag":null,"topics":["rubygem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/discourse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-26T15:19:27.000Z","updated_at":"2025-02-13T23:30:06.000Z","dependencies_parsed_at":"2024-01-17T08:44:51.091Z","dependency_job_id":"b16a2188-cb49-4706-a251-050f6a63ab22","html_url":"https://github.com/discourse/mail-receiver","commit_stats":{"total_commits":62,"total_committers":15,"mean_commits":4.133333333333334,"dds":0.7903225806451613,"last_synced_commit":"9b1b99902f2d71c8d38cc85cd125af1a7388ad11"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmail-receiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmail-receiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmail-receiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discourse%2Fmail-receiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discourse","download_url":"https://codeload.github.com/discourse/mail-receiver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248686058,"owners_count":21145413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rubygem"],"created_at":"2024-09-03T00:01:43.489Z","updated_at":"2025-04-13T08:40:57.931Z","avatar_url":"https://github.com/discourse.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"This container does the job of receiving an e-mail for a specified domain\nand spawning an instance of another container to do \"something\" with the\ne-mail.  That's it.  All very simple and straightforward.  You would\nthink...\n\n\n# Installation and Configuration\n\nMinimal configuration requires you to specify the domain you're receiving\nmail for, and how to connect to your Discourse instance (URL, API key, etc).\nThis involves setting the following environment variables:\n\n* `MAIL_DOMAIN` -- the domain name(s) to accept mail for and relay to\n  Discourse.  Any number of space-separated domain names can be listed here.\n\n* `DISCOURSE_BASE_URL` -- the base URL for this Discourse instance.\n  This will be whatever your Discourse site URL is. For example,\n  `https://discourse.example.com`. If you're running a subfolder setup,\n  be sure to account for that (ie `https://example.com/forum`).\n\n* `DISCOURSE_API_KEY` -- the API key which will be used to authenticate to\n  Discourse in order to submit mail.  The value to use is shown in the \"API\"\n  tab of the site admin dashboard.\n\n* `DISCOURSE_API_USERNAME` -- (optional) the user whose identity and\n  permissions will be used to make requests to the Discourse API.  This\n  defaults to `system` and should be OK for 99% of cases.  The remaining 1%\n  of times is where someone has (ill-advisedly) renamed the `system` user in\n  Discourse.\n\nFor a straightforward setup, the above environment variables *should* be\nenough to get you up and running.  If you have a desire for a more\ncomplicated setup, the following subsections may provide you with the power\nyou need.\n\n\n## Customised Postfix configuration\n\nYou can setup any Postfix configuration variables you need by setting env\nvars of the form `POSTCONF_\u003cvar\u003e` with the value of the variable you want.\nFor example, if you wanted to add a pre-delivery milter, you might use:\n\n    -e POSTCONF_smtpd_milters=192.0.2.42:12345\n\n## SPF, DKIM and DMARC checks\nThese checks are enabled by default in the latest image `discourse/mail-receiver:release`.\n\nYou may also decide whether or not to set up a Postfix server that has SPF, DKIM and DMARC checks configured by setting the build argument `INCLUDE_DMARC` to `true` or `false` when building the docker container for mail-receiver:\n\n```bash\ndocker build --build-arg INCLUDE_DMARC=true -t local_discourse/mail-receiver:latest .\n```\nConfigurations for these checks are stored in their respective configuration files `policyd-spf.conf`, `opendkim.conf`, `opendmarc.conf` in this repository.\n\n## Blacklisting sender domains\n\nThe `BLACKLISTED_SENDER_DOMAINS` environment variable accepts a\nspace-separated list of domain names.  Mail messages from these senders will\nbe fast-failed with SMTP code 554.\n\n\n## Syslog integration\n\nPostfix loves to log everything to syslog.  In fact, that's really all it\nsupports.  Since, by default, Docker is not known for its superlative\nout-of-the-box syslog integration, this container runs a tiny script which\nreads all syslog data and dumps it to the container's `stderr` (which is\nthen examinable by `docker logs`).\n\nIf, by some chance, you want to process your Postfix logs more extensively,\nyou can set `SOCKETEE_RELAY_SOCKET` and all syslog messages will also be\nsent to that socket for further processing.\n\n\n# Theory of Operation\n\nEvery e-mail that is received is delivered to a custom `discourse` service.\nThat service, which is a small Ruby program, makes a POST request to the\nadmin interface on the specified URL (`DISCOURSE_BASE_URL`), with the key\nand username specified.  Discourse itself stands ready to receive that\ne-mail and process it into the discussion, in exactly the same way as an\ne-mail received via POP3 polling.\n\nBefore delivery to the `discourse` service, a Postfix policy handler runs,\nasks Discourse if either the sender and/or recipient are invalid, and if so,\nrejects the incoming mail during the SMTP transaction, to prevent Discourse\nlater sending out reply emails due to incoming spam (\"backscatter\").\nLegitimate users will be notified of the failure by their MTA, and obvious\nspam just gets dropped without reply. This step is just about being a good\ncitizen of the Internet and not full spam filtering.\n\n### Development Note\n\nWhen changing files in the lib/ directory, make sure to publish a new rubygems\nversion once you are done by bumping the version in discourse_mail_receiver.gemspec\nand tagging a version starting with `v` in git e.g. `v1.0.4`, then push.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscourse%2Fmail-receiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscourse%2Fmail-receiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscourse%2Fmail-receiver/lists"}