npm i mailcow-api
(async () => {
//get global variables
require('dotenv').config();
//import the api client module
const {
MailcowApiClient
} = require("mailcow-api")
//create new mailcow api client with endpoint/baseurl and the api key
const mcc = new MailcowApiClient(process.env.MAILCOW_API_BASEURL, process.env.MAILCOW_API_KEY);
//get all domain on mailcow server
console.log(await mcc.getDomain());
})();
The line "require('dotenv').config();" gets the contents of a file called ".env" in which you should store your global and secret variables.
npm i dotenv
.env
MAILCOW_API_KEY='YOUR MAILCOW API KEY'
MAILCOW_API_BASEURL='https://mail.example.com' //no trailing slashes
process.env.MAILCOW_API_BASEURL
process.env.MAILCOW_API_KEY
If not: Do it now! It's easy! For Android you can use the andOTP app. andOTP can be used for 2FA with many services and is way better then the Google Authenticator app.
Feel free to contact me via xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy in english or german