KumoMTA doesn't enclose the display name in quotes

When using the HTTP API, KumoMTA doesn’t enclose the display name in quotes, resulting in errors. Example:

    'text_body': body['text'],
    'html_body': body['html'],
    'from': {
        'email': 'test@example.org',
        'name': 'Special, char,acters! $$ he, he'
    }
}

This results in the following header:

Is this intended behavior, or do I need to manually enclose the display name in quotes?

Here’s the error:

{"success_count":0,"fail_count":1,"failed_recipients":["simon+test-api@hehehe.simoncpu.example.com"],"errors":["simon+test-api@hehehe.simoncpu.example.com: invalid header: 0: at line 1:\nSpecial, char,acters! $$ he, he <test@example.org>\n ^_______________________________________________\nexpected ':', found ,\n\n1: at line 1, in group:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n2: at line 1, in Alt:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n3: at line 1, in address:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n4: at line 1, in Many1:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n5: at line 1, in obs_address_list:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n6: at line 1, in Alt:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n7: at line 1, in address_list:\nSpecial, char,acters! $$ he, he <test@example.org>\n^______________________________________________________\n\n\nstack traceback:\n\t[C]: in method 'from_header'\n\t/opt/kumomta/share/policy-extras/dkim_sign.lua:222: in upvalue 'do_dkim_sign'\n\t/opt/kumomta/share/policy-extras/dkim_sign.lua:355: in upvalue 'dkim_signer'\n\t[string \"/opt/kumomta/etc/policy/init.lua\"]:222: in function <[string \"/opt/kumomta/etc/policy/init.lua\"]:217>\n"]}

If I manually enclose it with quotes, I get these redundant quotes instead:

From: \"\\\"Special, char,acters! $$ he, he\\\"\" <test@example.org>

Same goes for recipients. The resulting header is:

Huh

KumoMTA does enclose the display name in quotes if it encounters special characters

this particular problem is only specific when the special character is a comma

I guess until a fix is available, you might have to replace the comma with a space or sth

Oki, got it!

Should be resolved by fix: using commas in display name w/ injection api · KumoCorp/kumomta@a290415 · GitHub

Thank you so much!!!

Perhaps, it would be a good idea to include semicolon (:wink: in the list as well

This is what I tried, but I’m not comfortable enough to push it, haha

If a quoted-string is related to atom, then..

We should put quotes around:

Quotes
All kinds of brackets
:
;
@
,
.

Just thinking out aloud