Manage your email aliases using the OVH API with Python.
Here what you'll need:
-
Python 3 (tested with 3.7.1)
-
OVH Python module: https://github.com/ovh/python-ovh
pip install ovh
-
Slugify Python module: https://github.com/un33k/python-slugify
pip install python-slugify
-
tldextract Python module: https://github.com/john-kurkowski/tldextract
pip install tldextract
Rename ovh.default.conf
to ovh.conf
and get your keys from https://eu.api.ovh.com/createToken/.
Note that this is for EU only. See others endpoints here.
Rename config.default.py
to config.py
and set your domain and your private email.
The following command line will add an alias [email protected]
(e.g. for creating an alias for Github)
python ovh_mail_alias_add.py https://github.com/Indigo744/ovh-manage-email-alias-python
Create email alias:
From : [email protected]
To : [email protected]
Continue (ENTER or CTRL+C to cancel)?
Alias created (ID=123456789)
Calling the script without any parameter will ask for your input.
The following command line will remove the alias we created just before
python ovh_mail_alias_rm.py 123456789
Delete the following alias:
ID : 123456789
From : [email protected]
To : [email protected]
Continue (ENTER or CTRL+C to cancel)?
Deleting...
Alias deleted!
The following command line will list all the aliases.
python ovh_mail_alias_ls.py
ID From To
123456789 [email protected] [email protected]
123545619 [email protected] [email protected]
351493542 [email protected] [email protected]
It procudes a TSV file (Tab-Separated File).
You can redirect the output to a file in order to open it in Excel or Calc.
python ovh_mail_alias_ls.py > list.tsv