Create A Temporary Email From The Command Line With tmpmail

tmpmail command line

tmpmail is a new command line utility for creating a temporary email address that you can use to avoid spam and protect your online privacy.

The tool makes use of 1secmail's (a disposable email service) API to receive the emails, and has only 3 dependencies: w3m, curl and jq.

Once installed, you can use the tmpmail command to generate a new email address (-g, --generate), view the most recent email received by the temporary email address (-r, --recent) with the option of removing HTML tags (-t, --text), and specify the web browser of your choice to render the HTML of the email (-b, --browser) instead of using the default w3m browser.

tmpmail lacks the ability to download email attachments, even though the 1secmail API supports it. It's also worth noting that you can't use this to send emails (either new or reply to received emails), as this isn't supported by the 1secmail service.

Installation and usage


To use tmpmail, make sure w3m, curl and jq are installed on your system. You'll also need to install git to get the tmpmail code from GitHub.

Install these packages on Debian / Ubuntu / Linux Mint, Fedora or Arch Linux / Manjaro:

  • Debian / Ubuntu / Linux Mint, and other Debian or Ubuntu based Linux distributions:
sudo apt install w3m curl jq git

  • Fedora:
sudo dnf install w3m curl jq git

  • Arch Linux / Manjaro:
sudo pacman -S w3m curl jq git

Now you can get tmpmail from GitHub and install it to /usr/local/bin:

git clone https://github.com/sdushantha/tmpmail

cd tmpmail

sudo install tmpmail /usr/local/bin

You can now start using tmpmail.

Run tmpmail in a terminal to create a temporary, disposable email address for the first time:

$ tmpmail 
[ Inbox for qtcxwqbqpke@1secmail.org ]

No new mail

Use tmpmail with the -g argument to generate a new email address:

tmpmail -g

Run tmpmail again to see if you have any new emails:

$ tmpmail
[ Inbox for qtcxwqbqpke@1secmail.org ]

84274824   linuxuprising@gmail.com     Tmpmail
84274359   contact@linuxuprising.com   Linux Uprising

To read an email, type tmpmail followed by the email ID, e.g.:

tmpmail 84274359

Or use this command to view the most recent email:

tmpmail -r

In case you're using the default w3m command line web browser for viewing the email and you want to exit, press q followed by y to confirm.

To change the web browser used to display the email, you can use tmpmail -b. E.g. to view the most recent email received by our disposable email account using Firefox web browser:

tmpmail -b firefox -r

h/t: u/imakethingswhenbored