11 Sep 2023 • Least effort self-destructing email addresses with Fastmail

Fastmail has a builtin tempomail provider ("Masked Email") which works and is good, but is mostly just barely too clunky to use much. So I made a sieve filter that lets me sign up for things with e.g. blah.temp20230101@... and auto-rejects emails received after the date in the address.

### Reject tempYYYYMMDD@ after the date in the address {{{
if anyof(
	address :matches :localpart "to" "*temp????????",
	address :matches :localpart "cc" "*temp????????",
	address :matches :localpart "bcc" "*temp????????",
	address :matches :localpart "deliveredTo" "*temp????????"
) {
	if currentdate :value "gt" "date" "${2}${3}${4}${5}-${6}${7}-${8}${9}" {
		reject "This address auto-rejects emails sent after ${2}${3}${4}${5}-${6}${7}-${8}${9}";
		stop;
	}
}
### }}}

Use it by going Settings > Mail rules > Edit custom Sieve code (at the bottom), and pasting it into the top box above the regular spam filtering (if you look at the hardcoded mail rules you can see where I got the header list from). You can test it with Fastmail's sieve tester by adding require ["date", "reject", "relational", "variables"]; at the top and putting To: blahtemp20230101@blah.com in the message box.

Daily Mail was my previous attempt at this, but only allowing mail through on the same day was too restrictive in practice.