mailbox-org-cli

command module
v0.0.0-...-7b53533 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 13 Imported by: 0

README

mailbox-org-cli

[!IMPORTANT] This project is non-functional for now. Mailbox.org have updated their login mechanism, which broke this program completely. I will hopefully get around to addressing this in the future, but it's fairly low down on my priority list. PR's welcome.

Unoffical command line "client" for managing mailbox.org disposable addresses.

TBH it's hard to call it client - it does not use API for achieve its goals, as there is no API for that feature.

What it does it pretends to be browser and interacts with management panel in good-old form-based way.

This is a fork of singles' repo, who has ceased development of the project. Issues and PRs are welcome here now!

Installation

If you have Go installed, you can either:

  • install it from source go install github.com/tjex/mailbox-org-cli@latest
  • clone repository and build it by yourself: go build . (requires Go 1.20) or go install . (installs to ${GOPATH}/bin)

Usage

Command line "client" for mailbox.org dispossable addresses feature
mailbox-org-cli 0.1.1
Usage: mailbox-org-cli --username USERNAME [--password PASSWORD] [--password-on-stdin] <command> [<args>]

Options:
  --username USERNAME    mailbox.org username [env: $MAILBOX_ORG_USERNAME]
  --password PASSWORD    mailbox.org password [env: $MAILBOX_ORG_PASSWORD]
  --password-on-stdin    read password from stdin
  --help, -h             display this help and exit
  --version              display version and exit

Commands:
  list                   list dispossable addresses
  renew                  renew dispossable address
  renew-all              renew all disposable addresses
  delete                 delete dispossable address
  set-memo               set-memo on existing dispossable address
  create                 create new dispossable address with optional memo

Here is an example how you can use this command with pass manager:

$ pass Email/mailbox.org | mailbox-org-cli --username you@example.com --password-on-stdin list

[
  {
    "email": "kajsdlkj230@temp.mailbox.org",
    "memo": "foo bar",
    "expires": "2022-02-28"
  },
  {
    "email": "aks92jasl943@temp.mailbox.org",
    "memo": "", # there's no memo set
    "expires": "2022-03-31"
  }
]

Or use environment variables:

# ~/.zshenv
export MAILBOX_ORG_PASSWORD="strong-password"
export MAILBOX_ORG_USERNAME="weak-email@mailbox.org"
$ mailbox-org-cli renew --id aks92jasl943@temp.mailbox.org

In terms of scripting, all output is JSON, so you can use jq to extract specific data. Using example output above this command will copy first item's email into clipboard:

mailbox-org-cli create | jq -j '.email' | <your-clipboard-program>
mailbox-org-cli list | jq -j '.[0].email' | <your-clipboard-program>
Possible use cases
  • mailbox.org's dispossable addresses have expiry date. But can be extended as many times as required. So if you want to have "permanent" address, just set cron every, lets say, 2 weeks with mailbox-org-cli renew.
  • as this is CLI tool, you can easily integrate it with some launcher like Alfred
  • ...your idea :)
Design decisions (from the original dev, Singles)
  1. Why it's in Go instead of JS/Python/PHP/other-scripting-language ?

First version was based on JS, but then I realized that I wanted single binary which can be run on scratch, without any JS, Python, PHP, Ruby, etc interpreter installed.

Technically - this could be written as a Bash script contining some curls and HTML parsing, but see above :)

  1. Why there are no tests?

Because of how surf works, it's hard to "feed" it with stubbed HTML content. Other solutions include using some HTTP mocking library or setuping some local mock server. Also, this isn't a tool which gets 23 releases per month, so I'm "testing" it manually.

  1. Why does it use username/password instead of token?

Becasue I didn't find a way to generate application token in Mailbox.org interface. Official API also requires username/password and gives you token which is valid only for 20 minutes.

One could probably use PHPSESSID but extracting this requires you either to dig into browser's Dev Tools or CLI tool should store it somewhere after first login.

Due to the fact that this tool isn't making dozens of API requests in one call and how fast login process is, ATM username/password is the way to go.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL