One of our customers reported that they are receiving errors when injecting using the HTTP API.
invalid header: 0: at line 1: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^_______________________________ expected ':', found < 1: at line 1, in group: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 2: at line 1, in Alt: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 3: at line 1, in address: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 4: at line 1, in Many1: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 5: at line 1, in obs_address_list: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 6: at line 1, in Alt: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ 7: at line 1, in address_list: =?UTF-8?q?=D8=B1=D9=87=D9=86=D9=85=D8=A7_=DA=A9=D8=A7=D9=84=D8=AC?= <no-␍ ^___________________________________________________________________________________________________ stack traceback: [C]: in method 'from_header' /opt/kumomta/etc/policy/dkim_sign.lua:244: in upvalue 'do_dkim_sign' /opt/kumomta/etc/policy/dkim_sign.lua:423: in upvalue 'dkim_signer' [string "/opt/kumomta/etc/policy/init.lua"]:454: in function <[string "/opt/kumomta/etc/policy/init.lua"]:370>
I tried reproducing this error and it seems like we get this error when the content.from.name parameter a non-ASCII string, and it appears to be triggered by some strings, not all.
First example, form.name is UTF-8 (رهنما کالج), from.email contains a -, fails.
Second example, from.name is UTF-8 (رهنما کالج), from.email does not contain a -, works fine.
Third example, from.name is ASCII, from.email contains a -, works fine.
Fourth example, from.name is a different UTF-8 string (فرهاد هدایتی فرد), from.email contains a -, works fine.
{"success_count":0,"fail_count":1,"failed_recipients":["hf.farhad@gmail.com"],"errors":["hf.farhad@gmail.com: invalid header: 0: at line 1:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n ^______________________________\nexpected ':', found <\n\n1: at line 1, in group:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n2: at line 1, in Alt:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n3: at line 1, in address:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n4: at line 1, in Many1:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n5: at line 1, in obs_address_list:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n6: at line 1, in Alt:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n7: at line 1, in address_list:\n=?UTF-8?q?=D8=A2=D9=87=D8=A7=D8=B3=D9=86=D8=AF?= <no-␍\n^_______________________________________________________________________________\n\n\nstack traceback:\n\t[C]: in method 'from_header'\n\t/opt/kumomta/etc/policy/dkim_sign.lua:244: in upvalue 'do_dkim_sign'\n\t/opt/kumomta/etc/policy/dkim_sign.lua:423: in upvalue 'dkim_signer'\n\t[string \"/opt/kumomta/etc/policy/init.lua\"]:454: in function <[string \"/opt/kumomta/etc/policy/init.lua\"]:370>\n"]}
Sorry, I think I missed the gist samples earlier. So there may be a combination of issues here. I have not had time to test these yet but will take a look.
Making some progress, but it is weird.
in some cases, it appears that certain characters in the from NAME are causing the from ADDRESS to put a space between the no- and reply:
“From: “آها سند” <no- reply@email.ahasend.com>”
^^ That space was not there when it was injected.
And if i use a different NAME the space does not appear.
There was some work done in that release that may be related, but it seems unlikely: A MIME message rebuild could improperly re-encode unicode Subject lines into a series of quoted-printable encoded-words, causing spaces between those words to be effectively discarded when the subject is decoded. The header re-encoding will now prefer to re-assemble unstructured fields as a single encoded-word to avoid this.