temp-email

NOTE WORK IN-PROGRESS, NOT YET READY FOR USE

Do you often give out temporary email addresses to online services or in-person? Is it annoying to have to set them up manually each time? Want to have them auto-generated based on a regex pattern?

temp-email provides a Postfix TCP map that dynamically generates temporary, expiring valid email addresses, so that you can pick one out of the air without having to configure it in advance, provided it matches a pattern. These temporary addresses can expire after a certain time, a certain number of uses, or both. After this temp-email will pretend that they are unknown, causing Postfix to reject any email sent to them. Finally, any of the expired addresses can be "aged out" and forgotten about after a long enough period of time so they will eventually work again.

Installation

TODO Write installation instructions here

Usage

Configuration

If run as root (not recommended), temp-email reads the configuration file /etc/temp-emailrc. If run as a user it reads ~/.temp-emailrc. The configuration files consists of single lines that are either configuration directives or pattern lines with a target address and at least one expiry directive.

Because Postfix supports TCP maps for virtual maps but not for aliases, patterns are matched against the full destination address (user@domain) not just the local address (user).

Example:

# this is the default port
port 9099

# this is the default window in seconds in which multiple queries from Postfix are considered a single query
grace 10
    
# any address beginning with "foo" gets sent to "[email protected]", expiring 48 hours after first use
/^foo/ [email protected] 48h

# the same but only works 3 times:
/^temp/ [email protected] 3x

# both at the same time (expires either after 5 uses or 7 days, whichever happens first)
/^paranoid/ [email protected] 5x 7d

# works only twice before expiring, but gets forgotten about after about 6 months
/^spy/ [email protected] 2x !180d

# default settings for any address - if set these directives are applied to all patterns unless overridden
* 10x !365d

If configured like the example above:

The next time Postfix receives an email to this address it queries temp-email again. This time:

If you also give out "[email protected]" it will get recorded separately in the database with its own expiry date.

Postfix Configuration

Development

TODO Write development instructions here

Contributing

  1. Fork it (https://github.com/joatca/temp-email/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors