Last active
January 24, 2025 00:40
-
-
Save itsuki-hayashi/8b33adfdde43970322d224874155d45a to your computer and use it in GitHub Desktop.
Proton Mail Sieve to enforce PGP encryption on all incoming emails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require ["reject", "imap4flags", "envelope", "extlists"]; | |
| if anyof ( | |
| # Domains for our addresses that we don't want to receive unencrypted emails. | |
| envelope :domain "to" "protonmail.com", | |
| envelope :domain "to" "proton.me", | |
| envelope :domain "to" "pm.me", | |
| envelope :domain "to" "protonmail.ch" | |
| ) { | |
| if allof ( | |
| # Reject unencrypted emails. | |
| not header :matches "X-Pm-Content-Encryption" "end-to-end", | |
| # Whitelist emails from my own addresses | |
| not header :list "from" ":addrbook:myself", | |
| # Whitelist emails in my allow list | |
| not header :list "from" ":incomingdefaults:inbox", | |
| # Whitelist emails in my contacts | |
| not header :list "from" ":addrbook:personal", | |
| # Whitelist emails in my organization's contacts | |
| not header :list "from" ":addrbook:organization", | |
| # As this sieve script will check your whitelist a.k.a ":incomingdefaults:inbox", you can mark domain as `Not Spam` which will whitelist the domain and all its subdomains. | |
| # For example, whitelist apple.com will also allow you to receive non-PGP encrypted emails from @email.apple.com and @id.apple.com, however not including emails from @itunes.com. | |
| ) { | |
| reject "Sorry, this email address only accepts PGP-encrypted emails. You can use Proton Mail (https://proton.me) or refer to the following link on how to use GnuPG to encrypt your email: https://ssd.eff.org/en/module-categories/tool-guides"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.