Create disposable mail directly from your Terminal

The only things that I hate most on the internet are spams and the people who spam. While surfing the web, we daily encounter tens of websites and people who ask for our mail and then spam us till eternity.

In this article I am going to talk about a tool called Tmpmail and how to install and set it up on Linux.

Every day, we surf the internet for hours and during this time we visit 100+ websites which ask us to subscribe to their services or to their newsletter.

Well, not every website is created by us who never spam their users ‘ ????. So you end up subscribing to a website who trade your data for money or to a sketchy mailing list which keeps you asking to get a credit card from hem.

The best way to avoid spam is not to subscribe to a sketchy looking mailing list (literally) and the other one is to use a disposable email address to subscribe to that service or website if you have doubt that it might be spam.

Tmpmail

There are hundreds of websites which offer you disposable email address which you can throw after use without any sign up.

Tmpmail is one such tool which does the same, but it allows you to instantly create and use a disposable email address right from your terminal.

It is a command line utility that allows you to create a disposable email address and receive emails to the disposable email address. It uses 1secmail’s API to receive emails.

You can see the email directly from your terminal or you can choose to display the email in the browser of your choice.

Tmpmail allows you to either choose a custom email or it will create a random email automatically.

Install Dependencies

Tmpmail depends upon three packages: w3m, jq and curl. We need to install these three before we can start using Tmpmail.

These dependencies are necessary to satisfy, in this step we are setting up these three dependencies before we move on to installing Tmpmail.

Install w3m by using the command below:

$ sudo apt install w3m 

This will install w3m on your system, it is a terminal based www browser.

Install curl by using the command below:

$ sudo apt install curl

Similarly, install jq :

$ sudo apt install jq 

These are the all dependencies that we needed to install. You can also install them from the Software manager, see the full guide to installing softwares on linux here.

Install Tmpmail

Now we are finally going to install tmpmail, use the command below to download tmpmail and make it executable.

$ curl -L "https://git.io/tmpmail" > tmpmail && chmod +x tmpmail

Now we will move tmpmail to the bin directory so that we can execute as a command.

To move tmpmail to bin and add it to your terminal as a command, use the command below:

$ sudo mv tmpmail /bin

Usage

To create a basic email address, use the following commands:

$ tmpmail

Output:

[ Inbox for 5vg4ajoxdho@1secmail.com ] 
No new mail

Now copy the generated email address and use it to get an email. Once an email has been sent to the following email address, you can run the same command again so check if you have received an email.

[ Inbox for 5vg4ajoxdho@1secmail.com ]
88366697 supersu@kerneltips.com From supersu

Now you can see the inbox for the disposable email address, here you can see the id of the mail, the email address that you received an email from and the subject.

Now copy the ID of the email that you want to view, for me its 88366697. You can view a specific email by using the command below.

$ tmpmail ID

Here you should replace the id with the id of the email that you received and copied in earlier step.

tempmail disposable mail for linux terminal

Now here I am able to see the email that I just sent from my mail account to the created disposable email. To quit press q. You can see additional options by right clicking in the terminal.

Advanced options

You can also create a specific email address instead of creating a random one using tmpmail.

To create a specific email address, use the following commands:

$ tmpmail -g email@1secmail.com/net/org

Here replace email with the email address of your choice and you can use any one of the available domains (com/net/org).

Example:

$ tmpmail -g supersu@1secmail.net

Again, use the tmpmail command to access your newly created email address.

To view the most recent email address, use this command.

$ tmpmail -r

You can view any email as just plain text where html code will be removed from the mail:

$ tmpmail -r -t

You can also use the id of the mail instead of -r and here -t is the suffix that removes html from the email.

Open email in a browser

As I mentioned earlier, instead of viewing in a terminal, you can also view your email in your preferred browser.

To view your mail in a browser, the syntax of the command is:

$ tmpmail --browser BROWSER ID

Here you should replace BROWSER with the command to launch your browser and replace ID with the id of the mail that you want to see or simply use -r to view the most recent email.

Example:

$ tmpmail --browser firefox -r

The above command will open my recent mail in a firefox. You can use whatever browser you would like to use with tmpmail.

Final Words

I think tmpmail is an amazing tool; I use it daily to prevent spam and phishing emails from reaching my inbox.

You should use this tool only with websites that you think might be phish or can send you unnecessary spam email.

Tell me your thoughts in the comments section and subscribe to our newsletter to receive our latest updates cause we never spam and it’s a promise.

Source: https://github.com/sdushantha/tmpmail

chevron_left
chevron_right