mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-09-11 16:01:28 +00:00
We've been hoping that mkdocs-material will ship the much anticipated search enhancements for some time, but it's time to recognize that we need to do something to improve the search results with how things work right now. This is a big commit that changes the titles of the various pages from the code-annotated synopsis to just the name of the function. This makes it much easier now to match things like `kumo.reject` directly, but `reject` remains awkward to find. I think this is the best that we can do at this time. A few functions have been annotated with the `status: deprecated` to show as deprecated in the toc/nav (shows with a little trash can next to the name).
49 lines
1.1 KiB
Markdown
49 lines
1.1 KiB
Markdown
---
|
|
tags:
|
|
- meta
|
|
---
|
|
|
|
# import_x_headers
|
|
|
|
```
|
|
message:import_x_headers([NAMES])
|
|
```
|
|
|
|
When called with no parameters, iterates the headers of the message, and for
|
|
each header with an `"X-"` prefix, imports the header into the message
|
|
metadata.
|
|
|
|
When called with a list of header names, only those headers, if present in the
|
|
message, will be imported to the message metadata. Header names passed in this
|
|
way do not need to have an `X-` prefix, making it convenient to use this method
|
|
as a way to import an arbitrary list of headers for logging purposes.
|
|
|
|
When importing an `X-` header, the header name is normalized to lowercase and any
|
|
`-` are transformed to underscores `_`.
|
|
|
|
For example, with a message content of:
|
|
|
|
```
|
|
X-Campaign-ID: 12345
|
|
X-Mailer: foobar
|
|
Subject: the subject
|
|
|
|
The body
|
|
```
|
|
|
|
calling:
|
|
|
|
```lua
|
|
message:import_x_headers()
|
|
print(message:get_meta 'x_campaign_id') -- prints 12345
|
|
print(message:get_meta 'x_mailer') -- prints foobar
|
|
```
|
|
|
|
but calling:
|
|
|
|
```lua
|
|
message:import_x_headers { 'x-campaign-id' }
|
|
print(message:get_meta 'x_campaign_id') -- prints 12345
|
|
print(message:get_meta 'x_mailer') -- prints nothing
|
|
```
|