Skip to content

Create SMTP Password method 🪪 Sub-Accounts

Creates a new SMTP password for the specified sub-account.

Usage

ts
import { MailChannelsClient, SubAccounts } from 'mailchannels-sdk'

const mailchannels = new MailChannelsClient('your-api-key')
const subAccounts = new SubAccounts(mailchannels)

const { data, error } = await subAccounts.createSmtpPassword('validhandle123')
ts
import { MailChannels } from 'mailchannels-sdk'

const mailchannels = new MailChannels('your-api-key')

const { data, error } = await mailchannels.subAccounts.createSmtpPassword('validhandle123')

Params

  • handle string required: The handle of the sub-account to create SMTP password for.

Response

  • data SubAccountsSmtpPassword | null nullable
    • enabled boolean guaranteed: Whether the SMTP password is enabled.
    • id number guaranteed: The SMTP password ID for the sub-account.
    • smtpPassword string guaranteed: SMTP password for the sub-account.
  • error ErrorResponse | null nullable: Error information if the operation failed.
    • message string guaranteed: A human-readable description of the error.
    • statusCode number | null nullable: The HTTP status code from the API, or null if the error is not related to an HTTP request. This field is intended for diagnostic use only and should not be relied upon.
    • type string guaranteed: A string identifier for the type of error. This field is intended for diagnostic use only and should not be relied upon.

Type declarations

Signature

ts
async function createSmtpPassword (handle: string): Promise<SubAccountsCreateSmtpPasswordResponse>

Response type declarations

ts
interface ErrorResponse {
  message: string;
  statusCode: number | null;
  type: ErrorType;
}
ts
type DataResponse<T> = {
  data: T;
  error: null;
} | {
  data: null;
  error: ErrorResponse;
};

SMTP Password type declarations

ts
interface SubAccountsSmtpPassword {
  enabled: boolean;
  id: number;
  smtpPassword: string;
}
ts
type SubAccountsCreateSmtpPasswordResponse = DataResponse<SubAccountsSmtpPassword>;

Source

SourcePlaygroundDocsTests

Released under the MIT License.