Skip to content

Mail

Mail

In-game email system with account creation, inbox/sent folders, attachments, read tracking, and soft-delete. Each player creates an email alias on a configurable domain.

Database Tables

TablePurpose
phone_mail_accountsEmail accounts -- identifier, alias, domain, email, password_hash, is_primary
phone_mail_messagesEmail messages -- sender_account_id, recipient_email, recipient_account_id, subject, body, attachments (JSON), is_read, is_deleted_sender, is_deleted_recipient
phone_mail_boxesMailbox counters -- account_id, unread_count, total_count (maintained by DB triggers)

Server Callbacks

CallbackPurpose
gcphone:mail:getStateReturns account info, inbox, sent, unread count, and domain (or setup prompt if no account)
gcphone:mail:createAccountCreates a new email account with alias and password
gcphone:mail:sendSends an email with optional attachments
gcphone:mail:markReadMarks a single message as read
gcphone:mail:getMessagesFetches messages for a folder (inbox/sent) with pagination
gcphone:mail:deleteSoft-deletes a message (sender or recipient side)

Config Options

lua
Config.Features.Mail = true

Config.Mail = {
    Enabled         = true,
    Domain          = 'jericofx.gg',
    MinAliasLength  = 3,
    MaxAliasLength  = 24,
    MaxSubjectLength = 120,
    MaxBodyLength   = 4000,
    Attachments = {
        MaxCount      = 5,
        MaxTotalSize  = 31457280,
        AllowedTypes  = { 'image', 'video', 'document', 'link' },
    },
}

Exports

ExportSignaturePurpose
SendInGameMail(fromIdentifier, payload) -> { success, id?, error? }Send an email programmatically from an external resource

Released under GPL-3.0 License