Code Monkey home page Code Monkey logo

gandi-mail's Introduction

gandi-mail

This repository contains a script to manage email addresses and aliases in a Gandi. It only contains a small set of the operations supported by Gandi, but those are the only ones that I use frequently.

If you need a more complete support please check out the official CLI. It is deprecated, but it should be still working.

Installation

You can put the script in any directory of your $PATH.

$ sudo install -v -o root -g root -t /usr/local/bin/ gandi-mail

It is also possible to use it directly from the repository directory.

Configuration

Before using the script you have to create an API key for your Gandi account:

  1. Open https://account.gandi.net.
  2. Open the Security section.
  3. On Production API key, generate a new one and store it in an api-key file.

See https://api.gandi.net/docs/authentication/ for more details.

The api-key can be encrypted with GnuPG. In such case, the name has to be api-key.gpg.

The file (either api-key or api-key.gpg) has to be stored in the $XDG_CONFIG_HOME/gandi-mail directory (usually, $HOME/.config/gandi-mail).

Usage

If you run gandi-mail with no arguments it prints a summary of the options:

$ gandi-mail
Usage /usr/local/bin/gandi-mail [command]

  COMMANDS:

  domains                 Show domains owned by your user.
  domain DOMAIN           Show information about a domain.

  emails ls DOMAIN        Show emails in a specific domain.
  emails add EMAIL        Add a new email to a domain.

  alias ls EMAIL          Show aliases for an email address.
  alias add EMAIL ALIAS   Add a new alias to the email address.
  alias rm EMAIL ALIAS    Remove an alias.

List Domains

gandi-mail domains shows domains visible to the account.

$ gandi-mail domains
FQDN         AUTORENEW  CREATED AT  REGISTRY ENDS AT
aaaaaa.com   true       2011-11-11  2023-01-02
bbbbbbb.dev  true       2020-01-02  2023-03-04

Domain Information

gandi-mail domain $DOMAIN shows a JSON object with all the information provided by Gandi in its API:

$ gandi-mail domain aaaaaa.com
{
  "fqdn": "aaaaaa.com",
  "tld": "com",
  "status": [
    "clientTransferProhibited"
  ],
  [...]

List Mailboxes

gandi-mail emails ls DOMAIN shows a list of all mailboxes created in the specified domain.

$ gandi-mail emails ls recense.dev
ADDRESS               TYPE      QUOTA USED  ALIASES  ID
[email protected]    standard  4           2        00000000-0000-0000-0000-000000000000
[email protected]  standard  5           5        00000000-0000-0000-0000-000000000001

Adding a New Mailbox

gandi-mail emails add EMAIL creates a new mailbox in the email found in the email address.

For example, the command gandi-mail emails add [email protected] creates a mailbox with the login foo in the domain example.com.

List Aliases for a Mailbox

gandi-mail alias ls EMAIL shows the existing aliases for the given mailbox.

$ gandi-mail alias ls [email protected]
foo
bar

Creating New Aliases

gandi-mail alias add EMAIL ALIAS adds a new alias to a mailbox.

For example, to create the address [email protected] as an alias of [email protected], we can use the following command:

$ gandi-mail alias add [email protected] bar
{
  "message": "The email mailbox is being updated."
}

Removing an Alias

gandi-mail alias rm EMAIL ALIAS removes an alias from a mailbox.

gandi-mail's People

Contributors

ayosec avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.