High Scripts

Documentation

Server

Server export functions / types

Mail

sendMail

Send mail from either the system or a player. To use HTML, action buttons, etc. you have to send a mail from the system by using one of the reservedUsers addresses you've configured in the mail app configuration.

Arguments

NameTypeDescription
dataMailDataMail data
source?numberPlayer's ID, only required if you're sending a mail on behalf of a player.

Example

server.lua
exports['high-phone']:sendMail({
    sender = '12345',
    recipients = { 'hello@high.mail', 'world@high.mail' },
    subject = 'Hello World',
    content = 'Hello Mars',
    attachments = {
        { 
            type = 'media', 
            content = {
                type = 'image', -- or 'video'
                url = 'https://i.imgur.com/6AnLddq.png'
            } 
        }
    }
}, 1)

getPlayerMailAccount

Get a player's mail account data

Arguments

NameTypeDescription
sourcenumberPlayer's ID

Example

server.lua
local account = exports['high-phone']:getPlayerMailAccount(1)
print(account?.address)

getOfflinePlayerMailAccount

Get an offline player's mail account data by player's identifier

Arguments

NameTypeDescription
identifierstringPlayer's identifier

Example

server.lua
local account = exports['high-phone']:getOfflinePlayerMailAccount('char1:2gtp1d6c57d7989ba1209e2c6gc9002f4872b856')
print(account?.address)

Messages

sendMessage

Send a message to a number from a number

Arguments

NameTypeDescription
dataMessageDataMessage data
source?numberPlayer's ID, only required if you're sending a message on behalf of a player.

Example

server.lua
exports['high-phone']:sendMessage({
    sender = '12345',
    recipients = { '123456' },
    content = 'Hello World',
    attachments = {
        { 
            type = 'media', 
            content = {
                type = 'image', -- or 'video'
                url = 'https://i.imgur.com/6AnLddq.png'
            }
        }
    }
}, 1)

Types

MessageData

NameTypeDescription
senderstringSender phone number
recipientstringRecipient's phone number
contentstringMessage content
attachmentsAttachment[]Attachments

MailData

NameTypeDescription
senderstringSender phone number
recipientsstring | string[]Recipient mail addresses
subjectstringMail subject
contentstringMail content
attachmentsAttachment[]Attachments

Last updated on

On this page