While using the HTTP injection API, I encountered an error in function
{“success_count”:0,“fail_count”:1,“failed_recipients”:[“arun******@gmail.com ”],“errors”:[“arun******@gmail.com : callback error\nstack traceback:\n\t[C]: in method ‘from_header’\n\t[string "/opt/kumomta/etc/policy/init.lua"]:168: in function <[string "/opt/kumomta/etc/policy/init.lua"]:165>\ncaused by: invalid header: 0: at line 1, in Eof:\ninfo@kumo.domain.com info@kumo.domain.com \n ^___________________________\n\n”]}
Below is the code from line 168:
kumo.on(‘http_message_generated’, function(msg)
local domain = msg:from_header().domain (line 168)
Hey there @kindhearted-deer , thanks for posting. Please read the “Troubleshooting” and “How to Ask for Help” buttons below. If you would like a 1:1 support session from the KumoMTA team, details are at the “Book a Support Session” button below.
tom
(Tom Mairs)
February 9, 2024, 1:14pm
3
It is quite possible you did not have a from header. Please post the injection string.
Below code is used for injection
`local msg_payload = kumo.json_encode {
envelope_sender = msg:sender().email,
content = msg_body,
recipients = {
{ email = msg:recipient().email },
},
}
print ("NEW PAYLOAD: " .. msg_payload)
local request = client:post 'http://127.0.0.1:8000/api/inject/v1'
request:header('Content-Type', 'application/json')
request:body(msg_payload)
local response = request:send()
print ("REsponse")
local resonsemsg = response:text()
local responsedetails = kumo.json_parse(resonsemsg)
print (responsedetails["success_count"])
if responsedetails["success_count"] == 1 then
print ("successful reinjection, deleting original")
msg:set_meta('queue', 'null')
return
end`
is ther any problem in above code ?
But this is working in “smtp_server_message_received” event. check below code
`kumo.on(‘smtp_server_message_received’, function(msg)
print(“domain”, msg:from_header().domain)`
Mike
(Mike Hillyer)
February 12, 2024, 1:11pm
5
Tom meant show the code that is injecting the HTTP request.
tom
(Tom Mairs)
February 12, 2024, 4:41pm
6
Yes. Did you use curl, or an injection tool or some code?
If you did not include, or malformed the “enveloper_sender”, then you will see the error message above.
{“content”:"received_at: 1707733591\r\nauthz_id: nameklive2x@domain.com \r\nreceived_from: 100.10.1.10:34400\r\nReceived: from kumo.domain.com (100.10.1.10)\r\n by kumo.domain.com (KumoMTA 100.10.1.10) \r\n with ESMTP id 304c53afc99111ee92880cc47a84106e for namekvinam@gmail.com ;\r\n Mon, 12 Feb 2024 10:26:31 +0000\r\nDate: Mon, 12 Feb 2024 10:26:31 +0000\r\nMessage-ID: 1707733591-MC0w@kumo.domain.com \r\nSubject: ooo\r\nFrom: "info@kumo.domain.com" info@kumo.domain.com \r\nTo: namekvinam@gmail.com \r\nReply-To: info@kumo.domain.com \r\nList-Unsubscribe: <>,\r\n mailto:unsub.cli0-0-0-0-42-0-0-0-p0@kumo.domain.com?subject=unsubscribe \r\nList-Unsubscribe-Post: List-Unsubscribe=One-Click\r\nX-campaignid: 0\r\nX-SentFromServer: 100.10.1.10\r\nContent-Disposition: inline\r\nX-Subscriber-ID: 0\r\nX-Report-Abuse: \r\nX-vinmail-version: 1\r\nX-ListMember: namekvinam@gmail.com \r\nx-job: 0.0\r\nMime-Version: 1.0\r\nContent-Type: multipart/alternative;\r\n boundary=015ce5ae3afbed01f398eea7343030724881a48c01996f19b78b6b279489\r\nX-Tracking-Id: 304c53afc99111ee92880cc47a84106e\r\nList-Unsubscribe: http://namegotracking.domain.com/us/MzA0YzUzYWZjOTkxMTFlZTkyODgwY2M0N2E4NDEwNmVfMTcwNzczMzU5MV80MjI=\r\nList-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n\r\n–015ce5ae3afbed01f398eea7343030724881a48c01996f19b78b6b279489\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\nNo preview available\r\n
–015ce5ae3afbed01f398eea7343030724881a48c01996f19b78b6b279489\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/html; charset=UTF-8\r\n\r\noooo\r\n–015ce5ae3afbed01f398eea7343030724881a48c01996f19b78b6b279489–\r\n<span style="display:none !important;" class="preheader"><img src="http://namegotracking.domain.com/opens/MzA0YzUzYWZjOTkxMTFlZTkyODgwY2M0N2E4NDEwNmVfMTcwNzczMzU5MV80MjI=/blank.gif\ " alt="open track" width="0" height="0" style="display:none !important;" /><td style="line-height: 25px;"><p style="font-size:12px; margin: 0;">If you wish to opt out of all type of emails, click <a style="color: #0096c7 ;" href="http://namegotracking.domain.com/us/MzA0YzUzYWZjOTkxMTFlZTkyODgwY2M0N2E4NDEwNmVfMTcwNzczMzU5MV80MjI=\“>Unsubscribe</a>.</p></td></tr>”,“envelope_sender”:“bounce.cli0-0-0-0-42-0-0-0-p0@kumo.domain.com”,“recipients”:[{“email”:“namekvinam@gmail.com”}] }
@faithful-ostrich this is the data posting the injection api
tom
(Tom Mairs)
February 15, 2024, 12:08am
10
I would test that in something like jsonlint. My guess is that you have an errant quote