mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-18 12:16:41 -04:00
rename api, add cc and bcc, handle multiple players
rename: src -> from, dst -> to
This commit is contained in:
parent
2d087eaa13
commit
522eb0a9ee
5 changed files with 115 additions and 21 deletions
25
api.md
25
api.md
|
@ -2,6 +2,25 @@
|
|||
# Mail format
|
||||
The mail format in the api hooks
|
||||
|
||||
```lua
|
||||
mail = {
|
||||
from = "sender name",
|
||||
to = "players, which, are, addressed",
|
||||
cc = "carbon copy",
|
||||
bcc = "players, which, get, a, copy, but, are, not, visible, to, others",
|
||||
subject = "subject line",
|
||||
body = "mail body",
|
||||
-- 8 attachments max
|
||||
attachments = {"default:stone 99", "default:gold_ingot 99"}
|
||||
}
|
||||
```
|
||||
|
||||
The fields `to`, `cc` and `bcc` can contain a player, multiple player names separated by commas, or be empty. Players in `to` are the recipiants, who are addressed directly. `cc` specifies players that get the mail to get notified, but are not immediate part of the conversation. There is no technical difference between `to` and `cc`, it just implies meaning for the players. Players can see all fields making up the mail except `bcc`, which is the only difference to `cc`.
|
||||
|
||||
Attachments need to be provided for each player getting the mail. Until this is implemented, trying to send a mail to multiple players will fail.
|
||||
|
||||
The `from` and `to` fields were renamed from the previous format:
|
||||
|
||||
```lua
|
||||
mail = {
|
||||
src = "source name",
|
||||
|
@ -22,8 +41,10 @@ mail.send("source name", "destination name", "subject line", "mail body")
|
|||
New variant (1.1+)
|
||||
```lua
|
||||
mail.send({
|
||||
src = "source name",
|
||||
dst = "destination name",
|
||||
from = "sender name",
|
||||
to = "destination name",
|
||||
cc = "carbon copy",
|
||||
bcc = "blind carbon copy",
|
||||
subject = "subject line",
|
||||
body = "mail body"
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue