I really thought I’m going crazy with this one, but from what I can tell, with some UTF-8 subjects, attachments (I’ve tested with PDF) will not be sent correctly - the attachment on the email will be a blank PDF (with the same number of pages as the original PDF, but all pages are blank). I’ve tried this with multiple PDF files - one page, multiple pages, with a short text, long text, tables, etc and got the same results.
For example, if the subject is test the PDF is sent correctly.
If the subject is تست the subject is again sent correctly.
But if the subject is بامداد سیر هرمزان R3TYRO the PDF attachment will be blank. (on Gmail at least)
Not sure if github handles the base64 lines correctly, please let me know if it doesn’t and I can send you the json files directly (couldn’t attach them here, seems like attachments are disabled).
$ jq . < ~/Downloads/payload-bad.json
jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 20, column 9188
I don’t see what could possibly cause this; if you diff the generated payloads, there’s no changes near the attachments.
Feels like it has to be a gmail bug somehow.
local kumo = require 'kumo'
-- Put your payload in a file here:
local request = kumo.serde.json_load '/home/wez/Downloads/payload-bad.json'
for _, msg in ipairs(kumo.api.inject.build_v1(request)) do
print(msg:get_data())
-- and optionally print the From header, and so on.
-- print(msg:get_first_named_header_value('from'))
end
And then run it with: kumod --script --policy test.lua
this will generate message(s) and print them out to stdout so that you don’t have to literally generate and send the message to see what is going on.