Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Runs a set of commands using the runners shell
- name: Run shellcheck
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ FROM alpine:3.15.4

RUN apk --no-cache add curl jq w3m xclip util-linux

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

RUN mv tmpmail /bin/
102 changes: 59 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
<p align="center"> A temporary email right from your terminal written in POSIX sh</p><br>

<img src="images/demo.gif" align="right"> `tmpmail` is a command line utility written in POSIX `sh` that allows you to create a temporary email address
and receive emails to the temporary email address. It uses 1secmail's [API](https://www.1secmail.com/api/)
to receive emails.
and receive emails to the temporary email address.

> **This is a maintained fork of [sdushantha/tmpmail](https://github.com/sdushantha/tmpmail).**
> Upstream used 1secmail's API, which has shut down (every request now returns `403 Forbidden`), so the
> original script no longer works. This fork talks to [Guerrilla Mail](https://www.guerrillamail.com/)
> by default, with [mail.tm](https://mail.tm/) as an alternative (`--provider mailtm`).

By default `w3m` is used to render the HTML emails on the terminal.
But if you prefer another text based web browser or would rather view the email in a GUI web browser such as Firefox, simply
Expand All @@ -19,37 +23,22 @@ use the `--browser` argument followed by the command needed to launch the web br
- `w3m`
- `curl`
- [`jq`](https://github.com/stedolan/jq)
- `xclip`
- `xclip` (optional, only for `--copy`)

## Installation
### Install locally

```bash
# Download the tmpmail file and make it executable
$ curl -L "https://raw.githubusercontent.com/sdushantha/tmpmail/master/tmpmail" > tmpmail && chmod +x tmpmail
$ curl -L "https://raw.githubusercontent.com/3-mmc/tmpmail/master/tmpmail" > tmpmail && chmod +x tmpmail

# Then move it somewhere in your $PATH. Here is an example:
$ mv tmpmail ~/bin/
```

### AUR
`tmpmail` is available on the [AUR](https://aur.archlinux.org/packages/tmpmail-git/), which is currently being maintained by [Benjamin B盲dorf](https://github.com/b12f)

```bash
$ yay -S tmpmail-git
```

### [Pacstall](https://github.com/pacstall/pacstall) (Debian/Ubuntu)
`tmpmail` is available on the [pacstall-programs repository](https://github.com/pacstall/pacstall-programs/blob/master/packages/tmpmail-bin/tmpmail-bin.pacscript), which is being currently being maintained by [wizard-28](https://github.com/wizard-28)

```
$ pacstall -I tmpmail-bin
```

### Nixpkgs
`tmpmail` is also available in the [nix package collection (only unstable currently)](https://search.nixos.org/packages?channel=unstable&show=tmpmail&from=0&size=50&sort=relevance&query=tmpmail), which is maintained by [legendofmiracles](https://github.com/legendofmiracles)

Either add it to your system packages, install it with nix-env or try it out in a ephemeral nix-shell `nix-shell -p tmpmail`
### Packages
The AUR (`tmpmail-git`), Pacstall (`tmpmail-bin`) and Nixpkgs (`tmpmail`) packages build the **upstream** script,
which still points at the dead 1secmail API. Until they switch to this fork, install it locally as shown above.

### Docker

Expand All @@ -67,12 +56,12 @@ $ docker run -it mail;
$ tmpmail --help
tmpmail
tmpmail -h | --version
tmpmail -g [ADDRESS]
tmpmail [-p PROVIDER] -g [ADDRESS | USERNAME]
tmpmail [-t | -b BROWSER] -r | ID

When called with no option and no argument, tmpmail lists the messages in
the inbox and their numeric IDs. When called with one argument, tmpmail
shows the email message with specified ID.
the inbox and their numbers. When called with one argument, tmpmail
shows the email message with that number (1 = newest).

-b, --browser BROWSER
Specify BROWSER that is used to render the HTML of
Expand All @@ -84,11 +73,15 @@ shows the email message with specified ID.
Copy the email address to your clipboard
-d, --domains
Show list of available domains
-g, --generate [ADDRESS]
Generate a new email address, either the specified ADDRESS, or
randomly create one
-g, --generate [ADDRESS | USERNAME]
Generate a new email address, either the specified ADDRESS, a
USERNAME on a random domain, or a completely random one
-h, --help
Show help
-p, --provider PROVIDER
Service used for new addresses: guerrilla (default) or mailtm.
Can also be set with TMPMAIL_PROVIDER. An existing address keeps
the provider it was made with.
-r, --recent
View the most recent email message
-t, --text
Expand All @@ -98,30 +91,52 @@ shows the email message with specified ID.
Show version
```

### Providers
| | Guerrilla Mail (`guerrilla`, default) | mail.tm (`mailtm`) |
| --- | --- | --- |
| Account | none, an address is just a username | created for every address |
| Domains | 11, all delivering to the same inbox | usually one |
| Mail kept | about an hour | until the account is deleted |
| Privacy | anyone who guesses the username can read the inbox | password protected |
| Limits | | account creation is rate limited |

The address, its provider and (for mail.tm) its password are stored in `/tmp/tmpmail`, so they are gone after a reboot.

### Examples
Create random email
```console
$ tmpmail --generate
xoithrjagpx@1secmail.net
an8xsqzo1ct@guerrillamailblock.com
```

Create custom email
```console
$ tmpmail --generate mycustomemail@1secmail.com
mycustomemail@1secmail.com
$ tmpmail --generate mycustomemail@sharklasers.com
mycustomemail@sharklasers.com
```

Pick only the username, on a random domain
```console
$ tmpmail --generate mycustomname
mycustomname@guerrillamail.net
```

Use mail.tm instead
```console
$ tmpmail --provider mailtm --generate
```

View the inbox
```console
$ tmpmail
[ Inbox for wdebivbyjor@1secmail.com ]
[ Inbox for mycustomname@guerrillamail.net ]

83414443 username@example.com Test Email
1 no-reply@guerrillamail.com Welcome to Guerrilla Mail
```

View the email
```console
$ tmpmail 83414443
$ tmpmail 1
```

View the most recent email
Expand All @@ -131,17 +146,18 @@ $ tmpmail -r

View emails as pure text
```console
$ tmpmail -t 83414443
To: wdebivbyjor@1secmail.com
From: username@example.com
Subject: Test Email

Hello World
$ tmpmail -t 1
To: mycustomname@guerrillamail.net
From: no-reply@guerrillamail.com
Subject: Welcome to Guerrilla Mail

[Attachments]
https://is.gd/aBCdEf [apple.jpg]
https://is.gd/AbCDeF [ball.jpg]
Dear Random User,
...
```

Attachments are downloaded to `/tmp/tmpmail/attachments/` and linked from the email.

## Credits
This script is heavily inspired by Mitch Weaver's [`1secmail`](https://github.com/mitchweaver/bin/blob/master/OLD/1secmail) script

The original `tmpmail` is by [Siddharth Dushantha](https://github.com/sdushantha).
Loading