Home Command line utilities Create Temporary Email Address From Command Line With Tmpmail

Create Temporary Email Address From Command Line With Tmpmail

Tmpmail allows you to create temporary and disposable email addresses right from your terminal

By sk
Published: Updated: 7.2K views

This brief guide explains what is temporary email, what is tmpmail and how to create temporary email address from command line with Tmpmail in Linux and Unix-like operating systems.

What is temporary email address or disposable email address?

Nowadays, a valid E-mail id is required by almost all web sites, blogs, forums and services. Some web sites will not allow you to use them without a registered account.

You can't even write a comment in those sites without an account. When creating an account with your Email, they will send a conformation E-mail and you have to verify it in-order to start using such web sites.

Many of you don't want to use your personal or professional E-mail id to sign-up in random sites and blogs. This is where the disposable email or temporary email comes in rescue.

A temporary mail id can be used to subscribe or create an account in situations where it is mandatory to confirm your Email. The temporary email ids can help you to keep spam out of your inbox, protect your privacy and stay safe online.

There are plenty of temporary email providers that allows you to quickly create a free disposable Email id, so you can use it wherever necessary. The temporary emails will be deleted by the providers after a certain period of time.

What is tmpmail?

Tmpmail is a command line utility that allows you to create temporary emails and receive the mails to these temporary email address in GNU/Linux and other Unix-like operating systems. It uses 1secmail's API to receive mails.

By default, Tmpmail uses w3m text browser to access your temporary mail box to read the mails. You can, of course, use any other text-based or graphical web browsers with --browser argument, followed by the command to launch the web browser. Tmpmail is just a Bash shell script and is released under MIT license.

Install tmpmail on Linux

Tmpmail requires the following prerequisites to work:

  • w3m
  • curl
  • jq
  • xclip
  • git

They are available in the official repositories of most Linux distributions. For instance, you can install w3m, curl , jq and git in Arch Linux and Manjaro Linux using command:

$ sudo pacman curl git jq w3m xclip

On Debian, Ubuntu and its derivatives:

$ sudo apt install curl git jq w3m xclip

Fedora, RHEL, CentOS, AlmaLinux and Rocky Linux::

Enable {EPEL} repository:

$ sudo dnf install epel-release

And the install the dependencies:

$ sudo dnf install curl git jq w3m xclip

openSUSE:

$ sudo dnf install curl git jq w3m xclip

After installing the prerequisites, git clone the tmpmail repository:

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

This will clone the contents of tmpmail repository in a local directory named tmpmail.

Copy the tmpmail script to your $PATH, for example /usr/local/bin.

$ sudo cp tmpmail/tmpmail /usr/local/bin/

Alternatively, you can download and install Tmpmail with curl like below:

$ curl -L "https://raw.githubusercontent.com/sdushantha/tmpmail/master/tmpmail" > tmpmail && chmod +x tmpmail

Move the executable to your $PATH:

$ mv tmpmail ~/bin/

Create Temporary Email Address From Command Line With Tmpmail

To create a temporary Email id using tmpmail, run:

$ tmpmail -g

Or,

$ tmpmail --generate

A temporary email id will be created with 1secmail.net domain name. In my case, I got the following id.

hosicrwxatb@1secmail.net

You can use this email id to register an account or download contents or comment in a site/forum/discussion board.

To check if the mail id works, just send a test mail to this temporary email address from one of your personal/professional mail id.

I am going to send a mail from my Gmail id.

Compose an Email in Gmail
Compose an Email in Gmail

Done! We just sent a test mail to a 1secmail email id.

Now go back to the Terminal and check if the mail has arrived as shown in the following step.

View mailbox with tmpmail

To access your 1secmail mail box, run the following command from your Terminal:

$ tmpmail

Sample output:

[ Inbox for hosicrwxatb@1secmail.net ]

84248310   info@ostechnix.com   Reg: Test mail

Here,

  • hosicrwxatb@1secmail.net - receiver's email id.
  • 84248310 - the message id.
  • info@ostechnix.com - sender's mail id.

Read mails

To read the messages, run tmpmail with the email message id like below:

$ tmpmail 84248310

Sample output:

To: hosicrwxatb@1secmail.net
From: info@ostechnix.com
Subject: Reg: Test mail

Hi,

This is just a test mail.

--
Regards,
The OSTechNix Team,
www.ostechnix.com


<=UpDn Viewing <tmpmail.html>
Read Email message using tmpmail
Read Email message using tmpmail

There it is! I can be able to access the mails from command line in w3m browser. To exit, press q followed by y.

Here is the short video demonstration for tmpmail.

Create temporary emails from command line with tmpmail in Linux

View most recent mails

If there are many mails in the mail box, you can directly open the most recent email message using -r flag.

$ tmpmail -r

View mails in different browsers

As stated already, tmpmail uses w3m text browser to read the mails in your mail box. You can also view the email content in other web browsers with -b or --browser option.

For instance, let us open the mail in Mozilla Firefox using the following command:

$ tmpmail -b /usr/bin/firefox 84248310

Or,

$ tmpmail --browser /usr/bin/firefox 84248310

Here, the mail is displayed in the graphical Firefox browser window.

Read emails in Firefox using tmpmail
Read emails in Firefox using tmpmail

View mails in plain text

Tmpmail displays the Email in HTML format by default. You also view plain text instead of the HTML format.

To do so, use -t or --text flags to read the messages:

$ tmpmail -t 84248310

Or,

$ tmpmail --text 84248310

Display help

To display tmpmail help section, run:

$ tmpmail -h

Or,

$ tmpmail --help

To print the version, run:

$ tmpmail --version

Conclusion

Temporary email addresses are very convenient to enjoy the most benefits of an Internet site without giving away your personal information. With tmpmail, it got even easier to create temporary email addresses and receive mails for command line nerds. Give it a try and let us know what you think about this project in the comment section below.

Resources:

Featured photo by Miguel Á. Padriñán from Pexels.

You May Also Like

1 comment

n23zbsyf4f September 21, 2020 - 10:33 pm

Inspired by tmpmail, pydispo is a python-powered platform-independent disposable mailbox, and it’s almost external dependency-less. Users can avoid spam and protect online privacy with pydispo CLI, and developers can do more by importing it as a module. Get it from https://github.com/aakash30jan/pydispo

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More