Git Product home page Git Product logo

mailbox-org-cli's Introduction

IMPORTANT

This project is archived, as I don't use Mailbox.org anymore and therefore I cannot test any potential changes. Feel free to fork it or use one of the existing forks instead.


mailbox-org-cli

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.

Installation

You can download prebuilt binary from Releases page, but at the moment macOS binary isn't signed & notarized so you will get a warning that application cannot be verified.

If you have Go installed, you can either:

  • install it from source go install github.com/singles/mailbox-org-cli@latest
  • clone repository and build it by yourself: go build . (requires Go 1.17)

Usage

Command line "client" for mailbox.org dispossable addresses feature
mailbox-org-cli 0.1.0
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
  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 password manager:

$ pass Email/mailbox.org | mailbox-org-cli --username [email protected] --password-on-stdin list

[
  {
    "email": "[email protected]",
    "memo": "foo bar",
    "expires": "2022-02-28"
  },
  {
    "email": "[email protected]",
    "memo": "", # there's no memo set
    "expires": "2022-03-31"
  }
]

All output is JSON, so you will probably need something like jq to extract specific data. Using example output above this command will copy first item's email into clipboard (pbcopy on macOS):

mailbox-org-cli ... list | jq --raw '.[0].email' | pbcopy

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

  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.

mailbox-org-cli's People

Contributors

singles avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

joelpet tjex

mailbox-org-cli's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.