Node.js
import { MailChannels } from "mailchannels-sdk";
const { PARENT_API_KEY, SUB_ACCOUNT_HANDLE } = process.env;
if (!PARENT_API_KEY) throw new Error("Set PARENT_API_KEY (a parent-account API key) before running");
if (!SUB_ACCOUNT_HANDLE) throw new Error("Set SUB_ACCOUNT_HANDLE (the sub-account whose SMTP passwords you want to list)");
const mailchannels = new MailChannels(PARENT_API_KEY);
const { data, error } = await mailchannels.subAccounts.listSmtpPasswords(SUB_ACCOUNT_HANDLE);
if (error) {
console.error("List SMTP passwords failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
parent_api_key = os.environ.get("PARENT_API_KEY")
handle = os.environ.get("SUB_ACCOUNT_HANDLE")
if not parent_api_key:
sys.exit("Set PARENT_API_KEY (a parent-account API key) before running")
if not handle:
sys.exit("Set SUB_ACCOUNT_HANDLE (the sub-account whose SMTP passwords you want to list)")
mailchannels.api_key = parent_api_key
response = mailchannels.SubAccounts.SmtpPasswords.list(handle)
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$parent_api_key = getenv('PARENT_API_KEY') or exit("Error: PARENT_API_KEY is not set\n");
$sub_account_handle = getenv('SUB_ACCOUNT_HANDLE') or exit("Error: SUB_ACCOUNT_HANDLE is not set\n");
$client = new Client(apiKey: $parent_api_key);
$response = $client->subAccounts->smtpPasswords->list($sub_account_handle);
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/sub-account/{handle}/smtp-password \
--header 'X-Api-Key: <x-api-key>'[
{
"enabled": true,
"id": 123,
"smtp_password": "<string>"
}
]Retrieve Sub-account SMTP Passwords
Retrieves details of all SMTP passwords associated with the specified sub-account. For security, the full SMTP password is not returned; only the password ID and a partially redacted version are provided.
GET
/
sub-account
/
{handle}
/
smtp-password
Node.js
import { MailChannels } from "mailchannels-sdk";
const { PARENT_API_KEY, SUB_ACCOUNT_HANDLE } = process.env;
if (!PARENT_API_KEY) throw new Error("Set PARENT_API_KEY (a parent-account API key) before running");
if (!SUB_ACCOUNT_HANDLE) throw new Error("Set SUB_ACCOUNT_HANDLE (the sub-account whose SMTP passwords you want to list)");
const mailchannels = new MailChannels(PARENT_API_KEY);
const { data, error } = await mailchannels.subAccounts.listSmtpPasswords(SUB_ACCOUNT_HANDLE);
if (error) {
console.error("List SMTP passwords failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
parent_api_key = os.environ.get("PARENT_API_KEY")
handle = os.environ.get("SUB_ACCOUNT_HANDLE")
if not parent_api_key:
sys.exit("Set PARENT_API_KEY (a parent-account API key) before running")
if not handle:
sys.exit("Set SUB_ACCOUNT_HANDLE (the sub-account whose SMTP passwords you want to list)")
mailchannels.api_key = parent_api_key
response = mailchannels.SubAccounts.SmtpPasswords.list(handle)
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$parent_api_key = getenv('PARENT_API_KEY') or exit("Error: PARENT_API_KEY is not set\n");
$sub_account_handle = getenv('SUB_ACCOUNT_HANDLE') or exit("Error: SUB_ACCOUNT_HANDLE is not set\n");
$client = new Client(apiKey: $parent_api_key);
$response = $client->subAccounts->smtpPasswords->list($sub_account_handle);
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/sub-account/{handle}/smtp-password \
--header 'X-Api-Key: <x-api-key>'[
{
"enabled": true,
"id": 123,
"smtp_password": "<string>"
}
]Headers
Path Parameters
Handle of the sub-account to retrieve the SMTP password for.
Was this page helpful?

