# SERVER EXPORTS

<details>

<summary>EmailMessage Structure</summary>

{% code lineNumbers="true" %}

```lua
{
  "id": 1,
  "emailId": 101,
  "senderId": 5,
  "senderUsername": "police_department",
  "recipients": ["citizen1", "citizen2"],
  "topic": "Traffic Violation",
  "message": "You have been fined $500 for speeding.",
  "isRead": false,
  "isFavourite": false,
  "isInbox": true,
  "isInBin": false,
  "images": ["[https://example.com/evidence.jpg](https://example.com/evidence.jpg)"],
  "createdAt": 1678900000
}
```

{% endcode %}

</details>

### Fetch Emails (By Source)

Fetches a list of emails for a player using their Server ID (Source). You can filter by inbox type (inbox, favourites, sent, bin).

{% code overflow="wrap" lineNumbers="true" %}

```lua
local emails = exports["17mov_Phone"]:Email_FetchEmailsBySrc(src, inboxType)
```

{% endcode %}

**Returns:**

* `EmailMessage[]`: An array of email objects.

<table><thead><tr><th width="123" align="center">Argument</th><th width="217" align="center">Type</th><th width="133" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">inboxType</td><td align="center"><p><code>"inbox" | "favourites"</code> </p><p><code>| "sent" | "bin"</code></p></td><td align="center">❌</td><td>Target inbox of player</td></tr></tbody></table>

### Fetch Emails (By Number)

Fetches a list of emails for a player using their phone number. You can filter by inbox type. (inbox, favourites, sent, bin).

{% code overflow="wrap" lineNumbers="true" %}

```lua
local emails = exports["17mov_Phone"]:Email_FetchEmailsByNumber(number, inboxType)
```

{% endcode %}

**Returns:**

* `EmailMessage[]`: An array of email objects.

<table><thead><tr><th width="123" align="center">Argument</th><th width="217" align="center">Type</th><th width="133" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's phone number.</td></tr><tr><td align="center">inboxType</td><td align="center"><p><code>"inbox" | "favourites"</code> </p><p><code>| "sent" | "bin"</code></p></td><td align="center">❌</td><td>Target inbox of player</td></tr></tbody></table>

### Send System Email (By Source)

Sends an automated system email to a player using their Server ID (Source). This is useful for job notifications, alerts, or automated messages.

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:Email_SendSystemEmailBySrc(src, topic, message, images)
```

{% endcode %}

<table><thead><tr><th width="112" align="center">Argument</th><th width="94" align="center">Type</th><th width="99" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">topic</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The subject line of the email.</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The main content of the email.</td></tr><tr><td align="center">images</td><td align="center"><code>string[]</code></td><td align="center">✅</td><td>An optional array of image URLs to attach.</td></tr></tbody></table>

### Send System Email (By Number)

Sends an automated system email to a player using their phone number. This is useful for job notifications, alerts, or automated messages.

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:Email_SendSystemEmailByNumber(number, topic, message, images)
```

{% endcode %}

<table><thead><tr><th width="112" align="center">Argument</th><th width="94" align="center">Type</th><th width="99" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's phone number.</td></tr><tr><td align="center">topic</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The subject line of the email.</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The main content of the email.</td></tr><tr><td align="center">images</td><td align="center"><code>string[]</code></td><td align="center">✅</td><td>An optional array of image URLs to attach.</td></tr></tbody></table>

### Send Email (By Source)

Sends an email to a player using their Server ID (Source) with a specified sender name.

{% code lineNumbers="true" %}

```lua
exports["17mov_Phone"]:Email_SendEmailBySrc(src, sender, topic, message, images, customUser)
```

{% endcode %}

<table><thead><tr><th width="118.5625" align="center">Argument</th><th width="94" align="center">Type</th><th width="99" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">sender</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The display name of the email sender. (if using fake-data set last variable to true)</td></tr><tr><td align="center">topic</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The subject line of the email.</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The main content of the email.</td></tr><tr><td align="center">images</td><td align="center"><code>string[]</code></td><td align="center">✅</td><td>An optional array of image URLs to attach.</td></tr><tr><td align="center">customUser</td><td align="center"><code>boolean</code></td><td align="center">✅</td><td>Set this to true, if sender is account that doesn't exist </td></tr></tbody></table>

### Send Email (By Number)

Sends an email to a player using their phone number with a specified sender name

{% code lineNumbers="true" %}

```lua
exports["17mov_Phone"]:Email_SendEmailByNumber(number, sender, topic, message, images)
```

{% endcode %}

<table><thead><tr><th width="129.9453125" align="center">Argument</th><th width="94" align="center">Type</th><th width="99" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's phone number.</td></tr><tr><td align="center">sender</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The display name of the email sender (if using fake-data set last variable to true)</td></tr><tr><td align="center">topic</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The subject line of the email.</td></tr><tr><td align="center">message</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The main content of the email.</td></tr><tr><td align="center">images</td><td align="center"><code>string[]</code></td><td align="center">✅</td><td>An optional array of image URLs to attach.</td></tr><tr><td align="center">customUser</td><td align="center"><code>boolean</code></td><td align="center">✅</td><td>Set this to true, if sender is account that doesn't exist </td></tr></tbody></table>
