init
This commit is contained in:
parent
9b96520954
commit
57020eebbe
131
.gitignore
vendored
Normal file
131
.gitignore
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
.vscode
|
||||
85
app/dsn_processor.py
Normal file
85
app/dsn_processor.py
Normal file
@ -0,0 +1,85 @@
|
||||
import Milter
|
||||
import sys
|
||||
import traceback
|
||||
import email
|
||||
import json
|
||||
|
||||
class DsnProcessorMilter(Milter.Base):
|
||||
def __init__(self):
|
||||
self.mail_data: str = ""
|
||||
|
||||
def process_dsn(self, mail_data: str):
|
||||
msg = email.message_from_string(mail_data)
|
||||
recipients = []
|
||||
for part in msg.walk():
|
||||
if part.get_content_type() == "message/delivery-status":
|
||||
for subpart in part.walk():
|
||||
rcpt = {}
|
||||
if 'Action' in subpart and 'Original-Recipient' in subpart:
|
||||
rcpt["action"] = subpart['Action']
|
||||
rcpt["orig_rcpt"] = subpart['Original-Recipient'].replace('rfc822;', '')
|
||||
rcpt["diag_code"] = None
|
||||
if 'Diagnostic-Code' in subpart:
|
||||
rcpt["diag_code"] = subpart['Diagnostic-Code']
|
||||
rcpt["status"] = None
|
||||
if 'Status' in subpart:
|
||||
rcpt["status"] = subpart['Status']
|
||||
recipients.append(rcpt)
|
||||
return recipients
|
||||
|
||||
# Not registered/used callbacks
|
||||
@Milter.nocallback
|
||||
def hello(self, heloname):
|
||||
return Milter.CONTINUE
|
||||
@Milter.nocallback
|
||||
def data(self):
|
||||
return Milter.CONTINUE
|
||||
|
||||
def connect(self, IPname, family, hostaddr):
|
||||
print("CONN: Client: {}".format(hostaddr[0]))
|
||||
return Milter.CONTINUE
|
||||
|
||||
# Mandatory callback
|
||||
def envfrom(self, mailfrom, *str):
|
||||
print("MAIL FROM: {}".format(mailfrom))
|
||||
self.mail_data = ""
|
||||
return Milter.CONTINUE
|
||||
|
||||
# Mandatory callback
|
||||
def envrcpt(self, to, *str):
|
||||
print("RCPT TO: {}".format(to))
|
||||
return Milter.CONTINUE
|
||||
|
||||
def header(self, name, hval):
|
||||
print("HDR: {0}: {1}".format(name, hval))
|
||||
self.mail_data += "{0}: {1}\n".format(name, hval)
|
||||
return Milter.CONTINUE
|
||||
|
||||
def eoh(self):
|
||||
self.mail_data += "\n"
|
||||
return Milter.CONTINUE
|
||||
|
||||
def body(self, chunk):
|
||||
self.mail_data += chunk.decode()
|
||||
return Milter.CONTINUE
|
||||
|
||||
def eom(self):
|
||||
dsn_details = self.process_dsn(self.mail_data)
|
||||
for d in dsn_details:
|
||||
print(json.dumps(d))
|
||||
return Milter.CONTINUE
|
||||
|
||||
def close(self):
|
||||
print("CLOSE")
|
||||
self.mail_data = ""
|
||||
return Milter.CONTINUE
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
timeout = 600
|
||||
Milter.factory = DsnProcessorMilter
|
||||
print("Starting dsn-processor-milter...")
|
||||
Milter.runmilter("dsn-processor-milter", "inet:4321@127.0.0.1" , timeout, True)
|
||||
except:
|
||||
print("MAIN-EXCEPTION: {}".format(traceback.format_exc()))
|
||||
sys.exit(1)
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
pymilter
|
||||
95
tests/DELAY.eml
Normal file
95
tests/DELAY.eml
Normal file
@ -0,0 +1,95 @@
|
||||
Return-Path: <>
|
||||
Delivered-To: cms@example.com
|
||||
Received: from mailbox-proxy-prod-1.mailbox-proxy-prod.prod.svc.cluster.local ([10.42.4.0])
|
||||
by mailbox-prod-0.mailbox.prod.svc.cluster.local with LMTP
|
||||
id 5/PjHmrAdGWpCwIAoCegqg:P1
|
||||
(envelope-from <>)
|
||||
for <cms@example.com>; Sat, 09 Dec 2023 20:30:50 +0100
|
||||
Received: from mailout.example.com ([10.42.4.0])
|
||||
by mailbox-proxy-prod-1.mailbox-proxy-prod.prod.svc.cluster.local with LMTP
|
||||
id 5/PjHmrAdGWpCwIAoCegqg
|
||||
(envelope-from <>)
|
||||
for <cms@example.com>; Sat, 09 Dec 2023 20:30:50 +0100
|
||||
Received: by mailout.example.com (Postfix)
|
||||
id 4SndQf2XKYzy; Sat, 9 Dec 2023 20:30:50 +0100 (CET)
|
||||
Date: Sat, 9 Dec 2023 20:30:50 +0100 (CET)
|
||||
From: Mail Delivery System <MAILER-DAEMON@example.com>
|
||||
Subject: Delayed Mail (still being retried)
|
||||
To: cms@example.com
|
||||
Auto-Submitted: auto-replied
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/report; report-type=delivery-status;
|
||||
boundary="4SndPw2c5Hzx.1702150250/mailout.example.com"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Message-Id: <4SndQf2XKYzy@mailout.example.com>
|
||||
|
||||
This is a MIME-encapsulated message.
|
||||
|
||||
--4SndPw2c5Hzx.1702150250/mailout.example.com
|
||||
Content-Description: Notification
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is the mail system at host mailout.example.com.
|
||||
|
||||
####################################################################
|
||||
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
|
||||
####################################################################
|
||||
|
||||
Your message could not be delivered for more than 0 hour(s).
|
||||
It will be retried until it is 5 day(s) old.
|
||||
|
||||
For further assistance, please send mail to postmaster.
|
||||
|
||||
If you do so, please include this problem report. You can
|
||||
delete your own text from the attached returned message.
|
||||
|
||||
The mail system
|
||||
|
||||
<chuck.norris@blah.blubb>: host cdxmailin01.blah.blubb[fd00:e50:f155:7::d0] said:
|
||||
450 4.2.0 <chuck.norris@blah.blubb>: Recipient address rejected: Sorry,
|
||||
please retry later. see
|
||||
https://postmaster.blah.blubb/greylisting/hilfe/blah.blubb.html, servertime=Dec
|
||||
09 20:30:50, server=mailin.prod.blah.blubb, client=fd03:4000:21:81b::1 (in
|
||||
reply to RCPT TO command)
|
||||
|
||||
--4SndPw2c5Hzx.1702150250/mailout.example.com
|
||||
Content-Description: Delivery report
|
||||
Content-Type: message/delivery-status
|
||||
|
||||
Reporting-MTA: dns; mailout.example.com
|
||||
X-Postfix-Queue-ID: 4SndPw2c5Hzx
|
||||
X-Postfix-Sender: rfc822; cms@example.com
|
||||
Arrival-Date: Sat, 9 Dec 2023 20:29:45 +0100 (CET)
|
||||
|
||||
Final-Recipient: rfc822; chuck.norris@blah.blubb
|
||||
Original-Recipient: rfc822;chuck.norris@blah.blubb
|
||||
Action: delayed
|
||||
Status: 4.2.0
|
||||
Remote-MTA: dns; cdxmailin01.blah.blubb
|
||||
Diagnostic-Code: smtp; 450 4.2.0 <chuck.norris@blah.blubb>: Recipient address
|
||||
rejected: Sorry, please retry later. see
|
||||
https://postmaster.blah.blubb/greylisting/hilfe/blah.blubb.html, servertime=Dec
|
||||
09 20:30:50, server=mailin.prod.blah.blubb, client=fd03:4000:21:81b::1
|
||||
Will-Retry-Until: Thu, 14 Dec 2023 20:29:45 +0100 (CET)
|
||||
|
||||
--4SndPw2c5Hzx.1702150250/mailout.example.com
|
||||
Content-Description: Undelivered Message Headers
|
||||
Content-Type: text/rfc822-headers
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Return-Path: <cms@example.com>
|
||||
Received: from x.y (unknown [100.64.121.182])
|
||||
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
||||
key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256
|
||||
client-signature ECDSA (P-256) client-digest SHA256)
|
||||
(Client CN "*.securemail.example.com", Issuer "Wonderland Securemail SubCA 2021" (verified OK))
|
||||
by mailout.securemail.example.com (Postfix) with ESMTPS id 4SndPw2c5Hzx
|
||||
for <chuck.norris@blah.blubb>; Sat, 9 Dec 2023 20:29:45 +0100 (CET)
|
||||
from:<devel@example.com>
|
||||
to:<chuck.norris@blah.blubb>
|
||||
message-id:<blah@blubb.lan>
|
||||
subject: dsn delay test
|
||||
date: 1234567
|
||||
|
||||
--4SndPw2c5Hzx.1702150250/mailout.example.com--
|
||||
92
tests/FAILURE.eml
Normal file
92
tests/FAILURE.eml
Normal file
@ -0,0 +1,92 @@
|
||||
Return-Path: <>
|
||||
Delivered-To: matt.stretcher@example.com
|
||||
Received: from mailbox-proxy-prod-0.mailbox-proxy-prod.prod.svc.cluster.local ([10.42.4.1])
|
||||
by mailbox-prod-1.mailbox.prod.svc.cluster.local with LMTP
|
||||
id h/6fI9SudGUNBQIAOm8Rag:P1
|
||||
(envelope-from <>)
|
||||
for <matt.stretcher@example.com>; Sat, 09 Dec 2023 19:15:48 +0100
|
||||
Received: from mailout.example.com ([10.42.4.1])
|
||||
by mailbox-proxy-prod-0.mailbox-proxy-prod.prod.svc.cluster.local with LMTP
|
||||
id h/6fI9SudGUNBQIAOm8Rag
|
||||
(envelope-from <>)
|
||||
for <matt.stretcher@example.com>; Sat, 09 Dec 2023 19:15:48 +0100
|
||||
Received: by mailout.example.com (Postfix)
|
||||
id 4Snbm411DRzx; Sat, 9 Dec 2023 19:15:48 +0100 (CET)
|
||||
Date: Sat, 9 Dec 2023 19:15:48 +0100 (CET)
|
||||
From: Mail Delivery System <MAILER-DAEMON@example.com>
|
||||
Subject: Undelivered Mail Returned to Sender
|
||||
To: matt.stretcher@example.com
|
||||
Auto-Submitted: auto-replied
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/report; report-type=delivery-status;
|
||||
boundary="4Snblp10ywzv.1702145748/mailout.example.com"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Message-Id: <4Snbm411DRzx@mailout.example.com>
|
||||
|
||||
This is a MIME-encapsulated message.
|
||||
|
||||
--4Snblp10ywzv.1702145748/mailout.example.com
|
||||
Content-Description: Notification
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is the mail system at host mailout.example.com.
|
||||
|
||||
I'm sorry to have to inform you that your message could not
|
||||
be delivered to one or more recipients. It's attached below.
|
||||
|
||||
For further assistance, please send mail to postmaster.
|
||||
|
||||
If you do so, please include this problem report. You can
|
||||
delete your own text from the attached returned message.
|
||||
|
||||
The mail system
|
||||
|
||||
<chuck.norris@blah.blubb>: host cdxmailin02.blah.com[100.64.49.209] said: 554
|
||||
5.7.0 Reject, id=53915-07 - DANGEROUS, servertime=Dec 09 19:15:48,
|
||||
server=mailin.prod.blah.blubb, client=100.64.121.182 (in reply to end of DATA
|
||||
command)
|
||||
|
||||
--4Snblp10ywzv.1702145748/mailout.example.com
|
||||
Content-Description: Delivery report
|
||||
Content-Type: message/delivery-status
|
||||
|
||||
Reporting-MTA: dns; mailout.example.com
|
||||
X-Postfix-Queue-ID: 4Snblp10ywzv
|
||||
X-Postfix-Sender: rfc822; matt.stretcher@example.com
|
||||
Arrival-Date: Sat, 9 Dec 2023 19:15:34 +0100 (CET)
|
||||
|
||||
Final-Recipient: rfc822; chuck.norris@blah.blubb
|
||||
Original-Recipient: rfc822;chuck.norris@blah.blubb
|
||||
Action: failed
|
||||
Status: 5.7.0
|
||||
Remote-MTA: dns; cdxmailin02.blah.com
|
||||
Diagnostic-Code: smtp; 554 5.7.0 Reject, id=53915-07 - DANGEROUS,
|
||||
servertime=Dec 09 19:15:48, server=mailin.prod.blah.blubb,
|
||||
client=100.64.121.182
|
||||
|
||||
--4Snblp10ywzv.1702145748/mailout.example.com
|
||||
Content-Description: Undelivered Message
|
||||
Content-Type: message/rfc822
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Return-Path: <matt.stretcher@example.com>
|
||||
Received: from nue01.example.com (unknown [100.64.121.182])
|
||||
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
||||
key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256
|
||||
client-signature ECDSA (P-256) client-digest SHA256)
|
||||
(Client CN "*.securemail.example.com", Issuer "Wonderland Securemail SubCA 2021" (verified OK))
|
||||
by mailout.securemail.example.com (Postfix) with ESMTPS id 4Snblp10ywzv
|
||||
for <chuck.norris@blah.blubb>; Sat, 9 Dec 2023 19:15:34 +0100 (CET)
|
||||
Date: Sat, 09 Dec 2023 19:15:33 +0100
|
||||
To: chuck.norris@blah.blubb
|
||||
From: matt.stretcher@example.com
|
||||
Subject: test Sat, 09 Dec 2023 19:15:33 +0100
|
||||
Message-Id: <20231209191533.001056@nue01.example.com>
|
||||
X-Mailer: swaks v20201014.0 jetmore.org/john/code/swaks/
|
||||
|
||||
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
|
||||
|
||||
|
||||
|
||||
--4Snblp10ywzv.1702145748/mailout.example.com--
|
||||
59
tests/MULTI.eml
Normal file
59
tests/MULTI.eml
Normal file
@ -0,0 +1,59 @@
|
||||
Date: Fri, 8 Jul 1994 09:21:47 -0400
|
||||
From: Mail Delivery Subsystem <MAILER-DAEMON@CS.UTK.EDU>
|
||||
Subject: Returned mail: User unknown
|
||||
To: <owner-ups-mib@CS.UTK.EDU>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/report; report-type=delivery-status;
|
||||
boundary="JAA13167.773673707/CS.UTK.EDU"
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: text/plain; charset=us-ascii
|
||||
|
||||
----- The following addresses had delivery problems -----
|
||||
<arathib@vnet.ibm.com> (unrecoverable error)
|
||||
<wsnell@sdcc13.ucsd.edu> (unrecoverable error)
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: message/delivery-status
|
||||
|
||||
Reporting-MTA: dns; cs.utk.edu
|
||||
|
||||
Original-Recipient: rfc822;arathib@vnet.ibm.com
|
||||
Final-Recipient: rfc822;arathib@vnet.ibm.com
|
||||
Action: failed
|
||||
Status: 5.0.0 (permanent failure)
|
||||
Diagnostic-Code: smtp; 550 'arathib@vnet.IBM.COM' is not a
|
||||
registered gateway user
|
||||
Remote-MTA: dns; vnet.ibm.com
|
||||
|
||||
Original-Recipient: rfc822;johnh@hpnjld.njd.hp.com
|
||||
Final-Recipient: rfc822;johnh@hpnjld.njd.hp.com
|
||||
Action: delayed
|
||||
Status: 4.0.0 (hpnjld.njd.jp.com: host name lookup failure)
|
||||
|
||||
Original-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
|
||||
Final-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
|
||||
Action: failed
|
||||
Status: 5.0.0
|
||||
Diagnostic-Code: smtp; 550 user unknown
|
||||
Remote-MTA: dns; sdcc13.ucsd.edu
|
||||
|
||||
Final-Recipient: rfc822; matt.stretcher@gmail.com
|
||||
Original-Recipient: rfc822;matt.stretcher@gmail.com
|
||||
Action: relayed
|
||||
Status: 2.0.0
|
||||
Remote-MTA: dns; gmail-smtp-in.l.google.com
|
||||
Diagnostic-Code: smtp; 250 2.0.0 OK 1702144068
|
||||
d13-20020a5d538d000000b003334f34b126si2395393wrv.344 - gsmtp
|
||||
|
||||
Original-Recipient: rfc822;Bob@Example.COM
|
||||
Final-Recipient: rfc822;Bob@Example.COM
|
||||
Action: delivered
|
||||
Status: 2.0.0
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: message/rfc822
|
||||
|
||||
[original message goes here]
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU--
|
||||
51
tests/MULTI_body.txt
Normal file
51
tests/MULTI_body.txt
Normal file
@ -0,0 +1,51 @@
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: text/plain; charset=us-ascii
|
||||
|
||||
----- The following addresses had delivery problems -----
|
||||
<arathib@vnet.ibm.com> (unrecoverable error)
|
||||
<wsnell@sdcc13.ucsd.edu> (unrecoverable error)
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: message/delivery-status
|
||||
|
||||
Reporting-MTA: dns; cs.utk.edu
|
||||
|
||||
Original-Recipient: rfc822;arathib@vnet.ibm.com
|
||||
Final-Recipient: rfc822;arathib@vnet.ibm.com
|
||||
Action: failed
|
||||
Status: 5.0.0 (permanent failure)
|
||||
Diagnostic-Code: smtp; 550 'arathib@vnet.IBM.COM' is not a
|
||||
registered gateway user
|
||||
Remote-MTA: dns; vnet.ibm.com
|
||||
|
||||
Original-Recipient: rfc822;johnh@hpnjld.njd.hp.com
|
||||
Final-Recipient: rfc822;johnh@hpnjld.njd.hp.com
|
||||
Action: delayed
|
||||
Status: 4.0.0 (hpnjld.njd.jp.com: host name lookup failure)
|
||||
|
||||
Original-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
|
||||
Final-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
|
||||
Action: failed
|
||||
Status: 5.0.0
|
||||
Diagnostic-Code: smtp; 550 user unknown
|
||||
Remote-MTA: dns; sdcc13.ucsd.edu
|
||||
|
||||
Final-Recipient: rfc822; matt.stretcher@gmail.com
|
||||
Original-Recipient: rfc822;matt.stretcher@gmail.com
|
||||
Action: relayed
|
||||
Status: 2.0.0
|
||||
Remote-MTA: dns; gmail-smtp-in.l.google.com
|
||||
Diagnostic-Code: smtp; 250 2.0.0 OK 1702144068
|
||||
d13-20020a5d538d000000b003334f34b126si2395393wrv.344 - gsmtp
|
||||
|
||||
Original-Recipient: rfc822;Bob@Example.COM
|
||||
Final-Recipient: rfc822;Bob@Example.COM
|
||||
Action: delivered
|
||||
Status: 2.0.0
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU
|
||||
content-type: message/rfc822
|
||||
|
||||
[original message goes here]
|
||||
|
||||
--JAA13167.773673707/CS.UTK.EDU--
|
||||
122
tests/SUCCESS.eml
Normal file
122
tests/SUCCESS.eml
Normal file
@ -0,0 +1,122 @@
|
||||
Return-Path: <>
|
||||
Delivered-To: matt.stretcher@example.com
|
||||
Received: from mailbox-proxy-prod-1.mailbox-proxy-prod.prod.svc.cluster.local ([10.42.4.0])
|
||||
by mailbox-prod-0.mailbox.prod.svc.cluster.local with LMTP
|
||||
id GffUKkSodGX7BQIAoCegqg:P1
|
||||
(envelope-from <>)
|
||||
for <matt.stretcher@example.com>; Sat, 09 Dec 2023 18:47:49 +0100
|
||||
Received: from mailout.example.com ([10.42.4.0])
|
||||
by mailbox-proxy-prod-1.mailbox-proxy-prod.prod.svc.cluster.local with LMTP
|
||||
id GffUKkSodGX7BQIAoCegqg
|
||||
(envelope-from <>)
|
||||
for <matt.stretcher@example.com>; Sat, 09 Dec 2023 18:47:48 +0100
|
||||
Received: by mailout.example.com (Postfix)
|
||||
id 4Snb7m3SkNzy; Sat, 9 Dec 2023 18:47:48 +0100 (CET)
|
||||
Date: Sat, 9 Dec 2023 18:47:48 +0100 (CET)
|
||||
From: Mail Delivery System <MAILER-DAEMON@example.com>
|
||||
Subject: Successful Mail Delivery Report
|
||||
To: matt.stretcher@example.com
|
||||
Auto-Submitted: auto-replied
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/report; report-type=delivery-status;
|
||||
boundary="4Snb7l0BLyzv.1702144068/mailout.example.com"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Message-Id: <4Snb7m3SkNzy@mailout.example.com>
|
||||
|
||||
This is a MIME-encapsulated message.
|
||||
|
||||
--4Snb7l0BLyzv.1702144068/mailout.example.com
|
||||
Content-Description: Notification
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is the mail system at host mailout.example.com.
|
||||
|
||||
Your message was successfully delivered to the destination(s)
|
||||
listed below. If the message was delivered to mailbox you will
|
||||
receive no further notifications. Otherwise you may still receive
|
||||
notifications of mail delivery errors from other systems.
|
||||
|
||||
The mail system
|
||||
|
||||
<matt.stretcher@gmail.com>: delivery via
|
||||
gmail-smtp-in.l.google.com[108.177.15.27]:25: 250 2.0.0 OK 1702144068
|
||||
d13-20020a5d538d000000b003334f34b126si2395393wrv.344 - gsmtp
|
||||
|
||||
--4Snb7l0BLyzv.1702144068/mailout.example.com
|
||||
Content-Description: Delivery report
|
||||
Content-Type: message/delivery-status
|
||||
|
||||
Reporting-MTA: dns; mailout.example.com
|
||||
Original-Envelope-Id: <e9cb6d8d-2877-4160-ab2e-69e5356d1ac6@example.com>
|
||||
X-Postfix-Queue-ID: 4Snb7l0BLyzv
|
||||
X-Postfix-Sender: rfc822; matt.stretcher@example.com
|
||||
Arrival-Date: Sat, 9 Dec 2023 18:47:46 +0100 (CET)
|
||||
|
||||
Final-Recipient: rfc822; matt.stretcher@gmail.com
|
||||
Original-Recipient: rfc822;matt.stretcher@gmail.com
|
||||
Action: relayed
|
||||
Status: 2.0.0
|
||||
Remote-MTA: dns; gmail-smtp-in.l.google.com
|
||||
Diagnostic-Code: smtp; 250 2.0.0 OK 1702144068
|
||||
d13-20020a5d538d000000b003334f34b126si2395393wrv.344 - gsmtp
|
||||
|
||||
--4Snb7l0BLyzv.1702144068/mailout.example.com
|
||||
Content-Description: Message Headers
|
||||
Content-Type: text/rfc822-headers
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Return-Path: <matt.stretcher@example.com>
|
||||
Received: from mailsubmission.securemail.example.com (nue02.example.com [100.64.120.225])
|
||||
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
||||
key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256
|
||||
client-signature ECDSA (P-256) client-digest SHA256)
|
||||
(Client CN "*.securemail.example.com", Issuer "Wonderland Securemail SubCA 2021" (verified OK))
|
||||
by mailout.securemail.example.com (Postfix) with ESMTPS id 4Snb7l0BLyzv
|
||||
for <matt.stretcher@gmail.com>; Sat, 9 Dec 2023 18:47:46 +0100 (CET)
|
||||
Received: from [192.168.178.140] (pd9540e9c.dip0.t-ipconnect.de [217.84.14.156])
|
||||
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
|
||||
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
|
||||
(No client certificate requested)
|
||||
by mailsubmission-zdf.example.com (Postfix) with ESMTPSA id 4Snb7h6DF1zt
|
||||
for <matt.stretcher@gmail.com>; Sat, 9 Dec 2023 18:47:44 +0100 (CET)
|
||||
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=example.com;
|
||||
s=mailout-zdf; t=1702144066;
|
||||
bh=ygpECpd+h4jAzrDCla9AX7n1iYKRzUCDUpwL+Ez/e9c=;
|
||||
h=Date:MIME-Version:To:From:Subject:Content-Type;
|
||||
b=CBsJdAjUkBQ1js93C3u2kWKL86L6TPGn4kjnqzOoB1Xv99wL96R/GG2Rq75pR6fPC
|
||||
EsfSR/GmqB9v6wZd1PKKobC2DOfy4/5n4Q3HsSsJNSEv3Y5jqphLFgRxDiPtTxh78u
|
||||
gFvHAxnPwGuWASQpMdGYA6C76BTxxXOXZwCifh5Y=
|
||||
Authentication-Results: mailsubmission-zdf.example.com;
|
||||
auth=pass smtp.auth=matt.stretcher@example.com smtp.mailfrom=matt.stretcher@example.com
|
||||
Message-ID: <e9cb6d8d-2877-4160-ab2e-69e5356d1ac6@example.com>
|
||||
Date: Sat, 9 Dec 2023 18:47:43 +0100
|
||||
MIME-Version: 1.0
|
||||
User-Agent: Mozilla Thunderbird
|
||||
Content-Language: en-US
|
||||
To: matt.stretcher Gmail <matt.stretcher@gmail.com>
|
||||
From: matt.stretcher <matt.stretcher@example.com>
|
||||
Subject: DSN SUCCESS request
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
X-Spamd-Bar: /
|
||||
X-Spamd-Result: default: False [-0.09 / 5.00];
|
||||
MIME_GOOD(-0.10)[text/plain];
|
||||
XM_UA_NO_VERSION(0.01)[];
|
||||
FREEMAIL_TO(0.00)[gmail.com];
|
||||
RCVD_COUNT_ZERO(0.00)[0];
|
||||
ASN(0.00)[asn:3320, ipnet:217.80.0.0/12, country:DE];
|
||||
ARC_NA(0.00)[];
|
||||
MID_RHS_MATCH_FROM(0.00)[];
|
||||
FREEMAIL_ENVRCPT(0.00)[gmail.com];
|
||||
TO_DN_ALL(0.00)[];
|
||||
FROM_HAS_DN(0.00)[];
|
||||
MIME_TRACE(0.00)[0:+];
|
||||
FROM_EQ_ENVFROM(0.00)[];
|
||||
TO_MATCH_ENVRCPT_ALL(0.00)[];
|
||||
RCPT_COUNT_ONE(0.00)[1]
|
||||
X-Rspamd-Action: no action
|
||||
X-Rspamd-Server: mailscan-prod-0
|
||||
X-Rspamd-Queue-Id: 4Snb7h6DF1zt
|
||||
|
||||
--4Snb7l0BLyzv.1702144068/mailout.example.com--
|
||||
70
tests/miltertest_multi.lua
Normal file
70
tests/miltertest_multi.lua
Normal file
@ -0,0 +1,70 @@
|
||||
-- https://mopano.github.io/sendmail-filter-api/constant-values.html#com.sendmail.milter.MilterConstants
|
||||
-- http://www.opendkim.org/miltertest.8.html
|
||||
|
||||
conn = mt.connect("inet:4321@127.0.0.1")
|
||||
if conn == nil then
|
||||
error "mt.connect() failed"
|
||||
end
|
||||
if mt.conninfo(conn, "localhost", "::1") ~= nil then
|
||||
error "mt.conninfo() failed"
|
||||
end
|
||||
|
||||
mt.set_timeout(3)
|
||||
|
||||
-- 5321.FROM
|
||||
if mt.mailfrom(conn, "<>") ~= nil then
|
||||
error "mt.mailfrom() failed"
|
||||
end
|
||||
if mt.getreply(conn) ~= SMFIR_CONTINUE then
|
||||
error "mt.mailfrom() unexpected reply"
|
||||
end
|
||||
|
||||
-- 5321.RCPT+MACROS
|
||||
mt.macro(conn, SMFIC_RCPT, "i", "4CgSNs5Q9sz7SllQ")
|
||||
if mt.rcptto(conn, "<some-id-stuff@example.com>") ~= nil then
|
||||
error "mt.rcptto() failed"
|
||||
end
|
||||
if mt.getreply(conn) ~= SMFIR_CONTINUE then
|
||||
error "mt.rcptto() unexpected reply"
|
||||
end
|
||||
|
||||
--mt.data(conn)
|
||||
|
||||
-- HEADERS
|
||||
if mt.header(conn, "From", '"MAILER DAEMON" <bouncer@blah.blubb>') ~= nil then
|
||||
error "mt.header(From) failed"
|
||||
end
|
||||
if mt.header(conn, "MIME-Version", "1.0") ~= nil then
|
||||
error "mt.header(MIME-Version) failed"
|
||||
end
|
||||
if mt.header(conn, "Content-Type", "multipart/report; report-type=delivery-status;\n\tboundary=\"JAA13167.773673707/CS.UTK.EDU\"") ~= nil then
|
||||
error "mt.header(Content-Type) failed"
|
||||
end
|
||||
|
||||
-- BODY
|
||||
if mt.bodyfile(conn, "MULTI_body.txt") ~= nil then
|
||||
error "mt.bodyfile() failed"
|
||||
end
|
||||
if mt.getreply(conn) ~= SMFIR_CONTINUE then
|
||||
error "mt.bodyfile() unexpected reply"
|
||||
end
|
||||
|
||||
-- EOM
|
||||
if mt.eom(conn) ~= nil then
|
||||
error "mt.eom() failed"
|
||||
end
|
||||
mt.echo("EOM: " .. mt.getreply(conn))
|
||||
if mt.getreply(conn) == SMFIR_CONTINUE then
|
||||
mt.echo("EOM-continue")
|
||||
elseif mt.getreply(conn) == SMFIR_REPLYCODE then
|
||||
mt.echo("EOM-reject")
|
||||
end
|
||||
|
||||
if not mt.eom_check(conn, MT_HDRADD, "X-ExOTA-Authentication-Results") then
|
||||
mt.echo("no header added")
|
||||
else
|
||||
mt.echo("X-ExOTA-Authentication-Results header added")
|
||||
end
|
||||
|
||||
-- DISCONNECT
|
||||
mt.disconnect(conn)
|
||||
Loading…
Reference in New Issue
Block a user