# Create Webmail session

Create a temporary session for a cPanel user to connect to Webmail.

Note:

The cPanel user must own the Webmail account.

### How to use this API

After you successfully call this API, you will need to log in to Webmail.
To do this, send an HTTP POST to https://$URL_AUTHTY:2096$token/login with a message body of session=$session where:

* $URL_AUTHTY represents the value from the hostname return.
  * If the hostname return value is null, enter the hostname of the server that answered the API function.
  * $token represents the value from the token return.
* $session represents the value of the session return.

For example, an HTTP POST may resemble the following:

https://hostname.example.com:2096/cpsess2462418786/login

With a message body of:

session=username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137

Endpoint: GET /Session/create_webmail_session_for_mail_user
Version: 11.136.0.19
Security: BasicAuth

## Query parameters:

  - `domain` (string, required)
    The domain for the Webmail account.
    Example: "example.com"

  - `login` (string, required)
    The Webmail account's username.
    Example: "username"

  - `locale` (string)
    The locale that the new session will use.

Note:

* You must only enter lowercase characters.
* This parameter defaults to the cPanel user's locale.
    Example: "en"

  - `remote_address` (string)
    The session's client IP address.

Note:

* If you run this function from the command line, this parameter is required.
* This parameter defaults to the API caller's IP address.
    Example: "192.168.0.1"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "create_webmail_session_for_mail_user"

  - `module` (string)
    The name of the module called.
    Example: "Session"

  - `result` (object)

  - `result.data` (object)

  - `result.data.hostname` (string,null)
    The Webmail server's hostname.

Note:

The function returns a null value when the Webmail server is not remote.
    Example: "hostname.example.com"

  - `result.data.session` (string)
    The session ID to submit via POST to begin using the new session.
    Example: "username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137"

  - `result.data.token` (string)
    A new security token.
    Example: "/cpsess2462418786"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.metadata.transformed` (integer)
    Post-processing may have transformed the data.
    Enum: 1

  - `result.status` (integer)
    - 1 - Success
- 0 - Failed: Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


