Problem/Justification
With the TrueNAS REST API being discontinued, there now appears to be no way that I’ve been able to find to provide attachments to the mail.send call which previously took attachments as an HTTP upload.
With midclt gaining the ability to receive calls via stdin, I would like to propose that the API gain the ability to instead accept an array directly for the attachments setting, in the format used by the REST API.
Impact
This should make it possible for midclt call mail.send to fully replace previously used mail sending methods.
User Story
A user previously using mail.send via the REST API will be able to switch over to midclt by simply moving their attachments array into the call object itself (rather than setting “attachments”: true separately).
For my own use case, this will make it easy to send S/MIME encrypted messages without having to jump through a bunch of extra hoops as I would be able to simply use the output of openssl cms -encrypt to build my attachments and send that, like I used to do using sendmail.
For example:
echo "{"subject":"Test message","to":"user@example.org","attachments":[{"headers":[{"name":"MIME-Version","value":"1.0"},{"name":"Content-Disposition","value":"attachment; filename=\"smime.p7m\""},{"name":"Content-Type","value":"application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\""},{"name":"Content-Transfer-Encoding","value":"base64"}],"content":"MIIDDgYJKoZIhvcNAQcDoIIC/zCCAvsCAQAxggK/MIICuwIBADCBojCBmzELMAkGA1UEBhMCR0IxETAP…"}]}" | midclt call mail.send
If I’ve somehow missed the correct way to send attachments now, do please let me know!