Home BASH Create Temporary Emails From Command Line With Tmpmail
Create Temporary Emails From Command Line With Tmpmail

Create Temporary Emails From Command Line With Tmpmail

By sk
2430 Views

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

What is temporary email or disposable email?

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
  • 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

On Debian, Ubuntu and its derivatives:

$ sudo apt install curl git jq w3m

Fedora, RHEL, CentOS:

$ sudo dnf install curl git jq w3m

openSUSE:

$ sudo dnf install curl git jq w3m

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/

Create Temporary Emails 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.

[email protected]

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 [email protected] ]

84248310   [email protected]   Reg: Test mail

Here,

Read mails

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

$ tmpmail 84248310

Sample output:

To: [email protected]
From: [email protected]
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

Temporary emails 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:

Related read:

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. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More