use canonical_name if it is available; report error when trying to send mail to non-existent players

This commit is contained in:
flux 2023-02-23 13:41:41 -08:00
parent 43bf5b9a6f
commit f7a7ef361a
No known key found for this signature in database
GPG key ID: 9333B27816848A15
5 changed files with 83 additions and 72 deletions

6
api.md
View file

@ -35,12 +35,13 @@ mail = {
## Sending mail
Old variant (pre-1.1)
```lua
mail.send("source name", "destination name", "subject line", "mail body")
local error = mail.send("source name", "destination name", "subject line", "mail body")
-- error will contain an error message if mail couldn't be delivered, otherwise nil
```
New variant (1.1+)
```lua
mail.send({
local error = mail.send({
from = "sender name",
to = "destination name",
cc = "carbon copy",
@ -48,6 +49,7 @@ mail.send({
subject = "subject line",
body = "mail body"
})
-- error will contain an error message if mail couldn't be delivered, otherwise nil
```
# Hooks