RedM documentation
Murphy's Telegram & Mail
Advanced
External API
Murphy's Telegram & Mail exposes exports and events so other resources can send mail programmatically.
External HUD Integration (Statebag)
murphy_post can sync the player's pending inbox count to a player statebag so any external HUD or resource can read it directly - no event listeners or extra glue required.
Configuration
When enabled, the client updates LocalPlayer.state[] every time the count changes:
- on character selection (initial fetch)
- when a new letter or telegram becomes available for pickup
- when the player picks one up at the post office The value is the number of letters/telegrams currently awaiting pickup in the player's personal inbox (delayed mail is excluded until it becomes available). BLN HUD reads LocalPlayer.state.telegramUnreadMessages by default, so the integration is plug-and-play - just leave the default key:
Custom HUDs / resources
Any client-side script can read the value:
Or watch for changes:
Disabling
If you don't want murphy_post to touch any statebag, set Config.InboxStateBag.enabled = false. The in-game HUD icon (Config.InboxIcon) keeps working independently.
Methods
Exports (recommended)
Events
Parameters
senderData (table, optional)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
identifier |
string | No | "SYSTEM" |
Sender's character identifier |
firstname |
string | No | "System" |
Sender's first name |
lastname |
string | No | "Admin" |
Sender's last name |
officeId |
string | No | nil |
Post office origin ID |
recipientData (table)
Option A - Send to a person:
Option B - Send to a job mailbox:
| Field | Type | Required | Description |
|---|---|---|---|
firstName |
string | Yes (if no mailboxId) | Recipient's first name |
lastName |
string | Yes (if no mailboxId) | Recipient's last name |
mailboxId |
string | Yes (if no name) | Target mailbox ID |
telegramData (table)
| Field | Type | Required | Description |
|---|---|---|---|
object |
string | Yes | Subject line |
body |
string | Yes | Message body |
signature |
string | No | Sender signature (defaults to sender name) |
templateId |
string | No | Telegram template ID |
fontId |
string | No | Font override |
letterData (table)
| Field | Type | Required | Description |
|---|---|---|---|
object |
string | Yes | Subject line |
body |
string | Yes | Message body |
signature |
string | No | Sender signature (defaults to sender name) |
packageType |
string | No | Item name to attach as package |
amount |
number | No | Package item quantity |
packageMeta |
table | No | Package item metadata |
templateId |
string | No | Letter template ID |
fontId |
string | No | Font override |
options (table, optional)
| Field | Type | Default | Description |
|---|---|---|---|
delay |
number | Config value | Seconds before document becomes available |
Return value
Error codes
| Code | Description |
|---|---|
recipient_not_found |
First/last name doesn't match any character |
missing_mailbox |
Mailbox routing requested but no mailboxId provided |
db_insert_failed |
Database insert error |
Important notes
No automatic charge
The exports do not charge the sender. If you want to bill the player, handle payment before calling the export:
Package items are NOT removed from inventory
When sending a letter with packageType, the item is not automatically removed from the sender's inventory. You must remove it yourself before calling the export:
Notifications
If the recipient is online and notifications are enabled (Config.LetterNotification / Config.TelegramNotification), they will receive an in-game notification.
Offline recipients
Mail sent to offline players is stored in the database. They will find it in their inbox next time they visit a post office.
Examples
Simple telegram to a player
Letter with item package
Telegram to a job mailbox
Newsletter to all online players
Scheduled reminder
Last updated: September 9, 2026