Sample jMilter request for the DATA stage:
{
"context": {
"stage": "DATA",
"sasl": {
"login": "user",
"method": "plain"
},
"client": {
"ip": "192.168.1.1",
"port": 34567,
"ptr": "mail.example.com",
"ehlo": "mail.example.com",
"activeConnections": 1
},
"tls": {
"version": "1.3",
"cipher": "TLS_AES_256_GCM_SHA384",
"cipherBits": 256,
"certIssuer": "Let's Encrypt",
"certSubject": "mail.example.com"
},
"server": {
"name": "Stalwart Mail Server",
"port": 25,
"ip": "192.168.2.2"
},
"queue": {
"id": "1234567890"
},
"protocol": {
"version": "1.0"
}
},
"envelope": {
"from": {
"address": "[email protected]",
"parameters": {
"size": 12345
}
},
"to": [
{
"address": "[email protected]",
"parameters": {
"orcpt": "rfc822; [email protected]"
}
},
{
"address": "[email protected]",
"parameters": null
}
]
},
"message": {
"headers": [
[
"From",
"John Doe <[email protected]>"
],
[
"To",
"Bill <[email protected]>, Jane <[email protected]>"
],
[
"Subject",
"Hello, World!"
]
],
"serverHeaders": [
[
"Received",
"from mail.example.com (mail.example.com [192.168.1.1]) by mail.foobar.com (Stalwart Mail Server) with ESMTPS id 1234567890"
]
],
"contents": "Hello, World!\r\n",
"size": 12345
}
}Notes:
- HTTP
POSTrequests are used with authentication being optional. - Message bodies are provided raw as content filters usually need to analyse the MIME structure as well.
- jMilters can be called from any stage of the SMTP transaction so most of these fields are optional.
message.headers[][]is an array of arrays to keep the JSON representation compact. This can be changed to an array of objects if needed.
replaceContents make sense.