mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-24 13:18:18 +00:00
67bf14ca20
Augment the docs to clarify that msg:append_header and msg:prepend_header do no modification of the value by default. Adjust the wrapping used by Header:new_unstructured so that it hard wraps before the SMTP line length limit. Add optional encode parameter to msg:append_header and msg:prepend_header so that those methods can opt-in to the Header:new_unstructured formatting. Add HeaderMap:append method to mirror the existing HeaderMap:prepend method. Add unit tests that demonstrate the effect of wrapping/encoding for both the "dumb" msg:append_header and msg:prepend_header functions, and the "smarter" HeaderMap:prepend and HeaderMap:append methods that always encode their parameters. Update the docs for the headermap flavor of these methods to indicate that they will always encode the value.
28 lines
717 B
Markdown
28 lines
717 B
Markdown
# append_header
|
|
|
|
```lua
|
|
message:append_header(NAME, VALUE)
|
|
```
|
|
|
|
Constructs a header from `NAME: VALUE` and appends it to the header portion of
|
|
the message.
|
|
|
|
The `VALUE` is taken as-is and used as the header value.
|
|
|
|
{{since('dev')}}
|
|
|
|
This method now accepts an additional optional `ENCODE` parameter, which should
|
|
be a boolean value:
|
|
|
|
```lua
|
|
message:append_header(NAME, VALUE, ENCODE)
|
|
```
|
|
|
|
When `ENCODE` is set to true then the `VALUE` will be encoded:
|
|
|
|
* If the header value is ascii then it will be soft wrapped at whitespace
|
|
around 75 columns, and hard-wrapped regardless of whitespace at 900 columns.
|
|
* If the header value is non-ascii then it will be quoted printable encoded
|
|
using RFC 2047 header encoding.
|
|
|