This topic explains how to install and use the Direct Mail SDK.
You can use OpenAPI to call, query, and debug Direct Mail API operations, and generate sample code.
The basic steps are as follows:
Go to the OpenAPI debugging page
The following example shows how to use the API operation to send emails:
Send an email (debug and view sample code)
To send a single email:
Debugging entry points and sample code:
https://api.alibabacloud.com/api/Dm/2015-11-23/SingleSendMail
Looping and concurrent calls are supported.
A single request supports up to 100 recipient addresses. For more information about other parameters, see SingleSendMail.
Send batch emails:
Debugging entry points and sample code:
https://api.alibabacloud.com/api/Dm/2015-11-23/BatchSendMail
You can use templates and recipient lists that you created in the console or by calling an API to send batch emails. For more information about other parameters, see BatchSendMail.
Query for the API operation and specify parameters
We recommend that you use the default API version 2015-11-23. This version receives continuous optimizations and updates without a change in the version name.

For more information, see the API documentation.

Select a programming language and debug
You can select a programming language and click Make Call.

Generate sample code for the call
Method 1: Use the Direct Mail SDK
Obtain the SDK installation command
After the test completes successfully, install the SDK on your local machine or test server.
In the SDK Information section, you can view the version and installation command for the Direct Mail SDK.


Method 2: Use CommonRequest
Switch to Common Mode to generate sample code. In this mode, parameters are passed in the request body by default instead of the URL, which prevents requests from being blocked due to an excessively long URL.

C# example:
References
Java generalized calls 1.0 (Deprecated)
Other considerations
Create an AccessKey
After you log on with your Alibaba Cloud account, you do not need to specify a key on the debug page. However, you must configure the key in your code to run it on a local machine or a server.
(Note: Alternatively, you can use an AccessKey from the Resource Access Management (RAM) service.)
Log on to the AccessKey Management console.
In the upper-right corner of the page, click Create AccessKey. The Create dialog box opens.
Read the prompt and click OK.
Do not hard-code the `accessKeyId` and `accessKeySecret` values in your code to prevent them from being leaked.
You can configure the `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` values as environment variables in your operating system. The Alibaba Cloud SDK retrieves these values from the environment variables for identity verification. For more information, see Identity verification configuration.