Skip to content

Send email ​

This document is automatically generated based on https://github.com/authing/authing-docs-factory based on https://api-explorer.genauth.ai V3 API, and is consistent with API parameters and return results. If the description of this document is incorrect, please refer to V3 API.

When sending emails, you must specify the email channel. Each mailbox can only send once in the same channel within one minute.

Method name ​

AuthenticationClient.sendEmail

Request parameters ​

NameTypeRequiredDefault valueDescriptionSample value
channelstringYes-SMS channel, specify the purpose of sending this SMS:
- CHANNEL_LOGIN: for user login
- CHANNEL_REGISTER: for user registration
- CHANNEL_RESET_PASSWORD: for resetting password
- CHANNEL_VERIFY_EMAIL_LINK: Used to verify the email address
- CHANNEL_UPDATE_EMAIL: used to modify the email
- CHANNEL_BIND_EMAIL: used to bind the email
- CHANNEL_UNBIND_EMAIL: used to unbind the email
- CHANNEL_VERIFY_MFA: used to verify MFA
- CHANNEL_UNLOCK_ACCOUNT: used for self-service unlocking
- CHANNEL_COMPLETE_EMAIL: used to complete the email information when registering/logging in
- CHANNEL_DELETE_ACCOUNT: used to cancel the account
CHANNEL_LOGIN
emailstringyes-email, case-insensitivetest@example.com

Sample code ​

ts
import { AuthenticationClient, Models } from "authing-node-sdk";

const authenticationClient = new AuthenticationClient({
  // Need to be replaced with your GenAuth AppId, Secret and Host
  appId: "GEN_AUTH_APP_ID",
  appSecret: "GEN_AUTH_APP_SECRET",
  appHost: "GEN_AUTH_APP_HOST",
});

(async () => {
  const result = await authenticationClient.sendEmail({
    email: "test@example.com",
    channel: Models.SendEmailDto.channel.CHANNEL_LOGIN,
  });

  console.log(JSON.stringify(result, null, 2));
})();

Request response ​

Type: SendEmailRespDto

NameTypeDescription
statusCodenumberBusiness status code, which can be used to determine whether the operation is successful, 200 Indicates success.
messagestringDescription
apiCodenumberSegmented error code, which can be used to get the specific error type (successful request does not return). For a detailed list of error codes, see: API Code List
requestIdstringRequest ID. Returned when the request fails.

Sample result:

json
{
  "statusCode": 200,
  "message": "Operation successful",
  "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c"
}

Data structure ​