so… as mentioned above, “Note that I have not tested that exact code snippet, …”
If you add a diagnostic log filter line to your init, you will see deeper diagnostic logging in your journal. kumo.set_diagnostic_log_filter 'kumod=debug'
and use this in a separate terminal session to trace the log feed: journalctl -r -n 10 -u kumomta.service
I am fixing many things in this config.
The reinjector is working, but you have no HTTP processor to process it.
also, I am working on a better way to delete the original message
OK, so you don’t actually have to do this with a custom connector and I will explain below. Before I do, I’d like to point out that this represents about $1000 US worth of PS time, so if you are able to process a donation to the cause, it would be greatly appreciated.
Here is proof of life from my own dev/test server:
Dec 20 19:50:22 ctest3.kumomta.com kumod[7756]: NEW PAYLOAD: {"envelope_sender":"mkt@mail.kumomta.com","content":"Received: from ctest3.kumomta.com (127.0.0.1)\r\n by kumo.domain.com (KumoMTA 127.0.0.1) \r\n with ESMTP id 02b6f4189f7111eebb62000d3ac431c3 for <tom@kumomta.com>;\r\n Wed, 20 Dec 2023 19:50:22 +0000\r\nDate: Wed, 20 Dec 2023 19:50:22 +0000\r\nTo: tom@kumomta.com\r\nFrom: mkt@mail.kumomta.com\r\nSubject: test Wed, 20 Dec 2023 19:50:22 +0000\r\nMessage-Id: <20231220195022.007770@ctest3.kumomta.com>\r\nX-Mailer: swaks v20201014.0 jetmore.org/john/code/swaks/\r\n\r\nThis is a test <img src=\"http://10.0.0.1/img_chania.jpg\" alt=\"Flowers in Chania\"> </body>\r\n\r\n\r\n","recipients":[{"email":"tom@kumomta.com"}]}
Dec 20 19:50:22 ctest3.kumomta.com kumod[7756]: Processing HTTP injection
Dec 20 19:50:22 ctest3.kumomta.com kumod[7756]: Processing the reinjected message
Dec 20 19:50:22 ctest3.kumomta.com kumod[7756]: successful reinjection, deleting original
You can start by removing the custom connector bits in get_queue_config and effectively move the custom connector code ( with some modification) right into the smtp_server_message_received event. You also need to add an http_message_generated event processor in order to handle the reinjection.
I’ve just noticed that this line: msg_body = msg_body:gsub("mailing", my_tracking_link .. " </body>")
should be msg_body = msg_body:gsub("</body>", my_tracking_link .. " </body>")