> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# Net

## Functions

### httpRequest

Performs a regular HTTP or HTTPS request. To perform an HTTPS request, insert "https\://" at the URL's beginning. The default request method is **GET**, TCP connect timeout is **6** seconds and total request timeout is **90** seconds. Learn more about the `limits`(/docs/guides/voxengine/limits).

```ts
httpRequest(url: string, callback: (result: HttpRequestResult) => void, options?: HttpRequestOptions): void
```

**Parameters**

### httpRequestAsync

Performs an asynchronous HTTP request. TCP connect timeout is 6 seconds and total request timeout is 90 seconds. Learn more about the `limits`(/docs/guides/voxengine/limits).

```ts
httpRequestAsync(url: string, options?: HttpRequestOptions): Promise<HttpRequestResult>
```

**Parameters**

### sendMail

Send email via the specified email server

```ts
sendMail(mailServerAddress: string, from: string, to: string | string[], title: string, body: string, callback: (result: SendMailResult) => void, options?: SendMailOptions): void
```

**Parameters**

### sendMailAsync

Send an email via a specified email server

```ts
sendMailAsync(mailServerAddress: string, from: string, to: string | string[], title: string, body: string, options?: SendMailOptions): Promise<SendMailResult>
```

**Parameters**

## Types

### HttpRequestOptions

Advanced HTTP request options.

*optional*

Optional. Timeout for the TCP connection to the address in seconds. The default value is **6**. The value can be only decreased.

*optional*

Optional. Whether to enable logging the POST request body. The default value is **false**.

*optional*

Optional. Request headers: \{'Content-Type': 'text/html; charset=utf-8', 'User-Agent': 'YourCustomUserAgent/1.0'}. Note that the default value for the 'User-Agent' header is **VoxEngine/1.0**.

*optional*

HTTP request type as a string: **GET**, **POST** etc. The default value is **GET**.

*optional*

Optional. Request parameters. They can be specified in the URL itself as well.

*optional*

Optional. Raw UTF-8 encoded data string or an array of bytes in any encoding generated by `str2bytes`(/docs/references/voxengine/str2bytes) to send as the HTTP request body when 'method' is set to **POST**, **PUT**, or **PATCH**.

*optional*

Optional. Whether `HttpRequestResult.data`(/docs/references/voxengine/net/httprequestresult#data) should contain a list of 1-byte numbers corresponding to the HTTP response data. If set to **false**, `HttpRequestResult.data`(/docs/references/voxengine/net/httprequestresult#data) is undefined.

*optional*

Optional. Timeout for getting a response to the request in seconds. The default value is **90**. The value can be only decreased.

### HttpRequestResult

HTTP response.

Response code. HTTP code (2xx-5xx) or one of our internal status codes
0[Voxengine limits](//voximplant.com/docs/references/voxengine/) are violated (e.g. HTTP request count exceeded)-1Unknown error-2Malformed URL-3Host not found-4Connection error-5Too many redirects-6Network error-7Timeout-8Internal error-9Server response is larger than 2 MB

*optional*

If `HttpRequestOptions.rawOutput`(/docs/references/voxengine/net/httprequestoptions#rawoutput) is true, data contains a list of 1-byte numbers corresponding to HTTP response data. If `HttpRequestOptions.rawOutput`(/docs/references/voxengine/net/httprequestoptions#rawoutput) is false, data is undefined.

*optional*

In case of an error contains the error description

*optional*

List of dictionaries with key and value fields representing HTTP headers returned by the remote server

*optional*

HTTP header string returned by the remote server, without processing

*optional*

HTTP response body if Content-Type is not binary

### SendMailOptions

Advanced options for sendMail method

*optional*

BCC addresses

*optional*

CC addresses

*optional*

Alternative HTML body

Login for mail server

Password for mail server

Mail server port

### SendMailResult

Result of sending an email

SMTP server response code

*optional*

Optional. SMTP server error message