How to Set up and Configure tmpmail
What is Tmpmail?
Tmpmail is a utility written in bash that allows a user to create and use a temporary email address for receiving emails from the command-line. Underneath the covers, the bash script uses 1secmail’s API to receive the emails. By default, email addresses are created at random unless a specific email address follows the --generate flag.
Currently, w3m renders the emails in an HTML format within the terminal. If preferred, a user can use a GUI or text-based browser to view the email by passing the --browser flag followed by the command needed to launch the web browser of your choice.
Why Use a Disposable Email from the Terminal?
A disposable email address can often be used to receive incoming mail from a website that asks for an email address in order to login or access the site. Using this script, we can avoid the spam that is commonly associated with this type of tactic. Apart from the concern with spam, an email address can be used to log in to other web services. Additionally, there is an increased need for privacy and security. Using a disposable email address is one way to achieve this as after a specific timeframe, the temporary email is deleted and the address canceled. Thus, we avoid spam and many other privacy and security issues.
To install tmpmail, we can use the wget command or curl command to download the script from GitHub. Next, open a terminal and then copy or type in the following command.
[root@host2 ~]# wget https:
// raw . githubusercontent . com/ sdushantha/ tmpmail/ master/ tmpmail --2020-12-29 12:31:32-- https:// raw. githubusercontent . com/ sdushantha/ tmpmail/ master/ tmpmail Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 184.108.40.206 Connecting to raw.githubusercontent.com (raw.githubusercontent.com) |151. 101. 248. 133 | : 443... connected. HTTP request sent, awaiting response... 200 OK Length: 12433 (12K) [text/plain] Saving to: ‘tmpmail.’ tmpmail 100%[=========>] 12.14K --.-KB/s in 0s 2020-12-29 12:31:32 (97.9 MB/s) - ‘tmpmail’ saved [12433/12433] [root@host2 ~]#
Now, run the chmod command against the script to modify the permissions, so the file is executable.
[root@host2 ~]# chmod -v +x tmpmail
Next, we will move the file to a location somewhere in our $PATH. Use the following command to accomplish this.
[root@host2 ~]# mv tmpmail /bin/ [root@host2 ~]# which tmpmail /usr/bin/tmpmail [root@host2 ~]#
Here is a copy of the script in its entirety for review. As you can see, there are multiple options which can be modified to suit our specific needs.
To view the contents of the help file, type in the following commands. This info will provide a short man-type listing of how to use tmpmail.
[root@host2 ~]# tmpmail --help tmpmail tmpmail -h | --version tmpmail -g [ADDRESS] tmpmail [-t | -b BROWSER] -r | ID When called with no option and no argument, tmpmail lists the inbox messages and their numeric IDs. When called with one argument, tmpmail shows the email message with the specified ID. -b, --browser BROWSER Specify BROWSER (default: w3m) that is used to render the HTML of the email -g, --generate [ADDRESS] Generate a new email address, either the specified ADDRESS, or randomly create one -h, --help Show help -r, --recent View the most recent email message -t, --text View the email as raw text, where all the HTML tags are removed. Without this option, HTML is used. --version Show version [root@host2 ~]#
Generate a New tmpmail Address
To create a new temporary email address, run the following command.
[root@host2 ~]# tmpmail --generate email@example.com [root@host2 ~]#
We can now use the firstname.lastname@example.org temporary email address to send and receive messages.
I tested this installation by sending an email to the address above (email@example.com) from a Gmail account to test its functionality. After a few minutes, I received this output after running the tmpmail command.
[root@host2 ~]# tmpmail [ Inbox for firstname.lastname@example.org ] 105575154 email@example.com Tmpmail Test [root@host2 ~]#
This indicates that the email went through as was received by tmpmail. I can now view the email as raw text, where all the HTML tags are removed by running this command.
[root@host2 ~]# tmpmail 105575154
This view uses the w3m text-based browser to read my incoming email. Once I have completed reading the email, hit ‘q,’ and then, when prompted, ‘Do you want to exit w3m? (y/n), hit ‘y’, and the browser will close and return you to the command prompt.
View Recent Email
If there are multiple emails in the inbox, the most recent one can be reviewed by running this command.
[root@host2 ~]# tmpmail -r
If numerous emails have been received, we can rerun the tmpmail command to see a list of the current emails.
[root@host2 ~]# tmpmail [ Inbox for firstname.lastname@example.org ] 105576629 email@example.com Re: Tmpmail Test 105575154 firstname.lastname@example.org Tmpmail Test [root@host2 ~]#
As you can see, I replied to the earlier email, and it is now in my inbox.
Change Browser Type
I can also change the browser type to render the HTML of the email by running one of the following commands.
[root@host2 ~]# tmpmail --browser lynx 105576629 [root@host2 ~]# tmpmail -b lynx 105576629
Additionally, if I have a browser like Firefox installed, I can use Firefox's path to open the email.
[root@host2 ~]# tmpmail -b /usr/bin/firefox 105576629
View Email in Plaintext
We also can view the email in plaintext format. To read the email in this format, use the -t or --text flags to read the message.
[root@host2 ~]# tmpmail -t 105576629 [root@host2 ~]# tmpmail --text 105576629 To: email@example.com From: firstname.lastname@example.org Subject: Re: Tmpmail Test This is a 2nd test email. Regards, ===================== David Singer LiquidWeb Marketing Team Liquid Web Inc. On Tue, Dec 29, 2020 at 4:42 PM David Singer <email@example.com> wrote: Test1 Regards, ===================== David Singer LiquidWeb Marketing Team Liquid Web Inc. [root@host2 ~]#
What About Attachments?
I was also wondering if the temp email could receive an attachment. In this test, I created a new email from the Gmail account and attached a text file to see if it would provide a link to the file.
[root@host2 ~]# tmpmail [ Inbox for firstname.lastname@example.org ] 105578915 email@example.com Attachment Test Email 105576629 firstname.lastname@example.org Re: Tmpmail Test 105575154 email@example.com Tmpmail Test [root@host2 ~]#
Well, the email arrived. Let’s see if the attachment stayed attached!
[root@host2 ~]# tmpmail 105578915
There was no attachment seen in the w3m view. Next, I checked the plaintext view.
[root@host2 ~]# tmpmail -t 105578915 To: firstname.lastname@example.org From: email@example.com Subject: Attachment Test Email In this email, I created a text file, attached it, and sent it to the tmpmail email address I created. Here ya go! Regards, ===================== David Singer LiquidWeb Marketing Team Liquid Web Inc. [root@host2 ~]#
The attachment was not seen here either. In reviewing the API from 1secmail.com, the API can receive attachments, but this script may not be equipped to use that functionality.
Can I Send Outgoing Email Using tmpmail?
Unfortunately not. The server we are connecting to is only an inbound email relay.
Where Does the Domain Originate From?
If you are like me, you are probably curious where the wwjmp.com domain originated from. Like other temporary email services (e.g., temp-mail.org, 10minutemail.com), the domain name is pulled from domains owned by 1secmail. The email address is then generated via an API call from 1secmail.com and linked to one of the following domains.
Using this method, they can generate an almost infinite number of email addresses across those five domains.
In review, tmpmail is a handy utility for those CLI warriors who choose to stay within the command line for almost every role or purpose. As we have shown, it is a quick, safe, and easy method to create a temporary email address to use for incoming mail.
We pride ourselves on being The Most Helpful Humans In Hosting™!
Our Support Teams are filled with experienced Linux technicians and talented system administrators who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.
Should you have any questions regarding this information, we are always available to answer any inquiries with issues related to this article, 24 hours a day, 7 days a week 365 days a year.
If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner, and you are unsure about the information outlined, we can be reached via phone at @800.580.4985, a chat or support ticket to assisting you with this process.
About the Author: David Singer
I am a g33k, Linux blogger, developer, student, and former Tech Writer for Liquidweb.com. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Guide on Connecting to Remote Servers Using SSH in Linux, Windows, or macOS SystemsRead Article
New User Tutorial: What is DNS?Read Article