Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymilter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
misc
pymilter
Commits
5ad6d321
Commit
5ad6d321
authored
18 years ago
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Do plain CBV when template missing.
parent
d01dc65f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Milter/dsn.py
+5
-5
5 additions, 5 deletions
Milter/dsn.py
bms.py
+24
-16
24 additions, 16 deletions
bms.py
with
29 additions
and
21 deletions
Milter/dsn.py
+
5
−
5
View file @
5ad6d321
...
...
@@ -5,6 +5,9 @@
# Send DSNs, do call back verification,
# and generate DSN messages from a template
# $Log$
# Revision 1.12 2006/07/26 16:37:35 customdesigned
# Support timeout.
#
# Revision 1.11 2006/06/21 21:07:11 customdesigned
# Include header fields in DSN template.
#
...
...
@@ -79,6 +82,8 @@ def send_dsn(mailfrom,receiver,msg=None,timeout=600):
def
create_msg
(
q
,
rcptlist
,
origmsg
=
None
,
template
=
None
):
"
Create a DSN message from a template. Template must be
'
\n
'
separated.
"
if
not
template
:
return
None
heloname
=
q
.
h
sender
=
q
.
s
connectip
=
q
.
i
...
...
@@ -98,11 +103,6 @@ def create_msg(q,rcptlist,origmsg=None,template=None):
msg
.
add_header
(
'
X-Mailer
'
,
'
PyMilter-
'
+
Milter
.
__version__
)
msg
.
set_type
(
'
text/plain
'
)
if
not
template
:
if
spf_result
and
spf_result
.
startswith
(
'
softfail
'
):
template
=
softfail_msg
else
:
template
=
nospf_msg
hdrs
,
body
=
template
.
split
(
'
\n\n
'
,
1
)
for
ln
in
hdrs
.
splitlines
():
name
,
val
=
ln
.
split
(
'
:
'
,
1
)
...
...
This diff is collapsed.
Click to expand it.
bms.py
+
24
−
16
View file @
5ad6d321
#!/usr/bin/env python
# A simple milter that has grown quite a bit.
# $Log$
# Revision 1.77 2006/12/31 03:07:20 customdesigned
# Use HELO identity if good when MAILFROM is bad.
#
# Revision 1.76 2006/12/30 18:58:53 customdesigned
# Skip reputation/whitelist/blacklist when rejecting on SPF. Add X-Hello-SPF.
#
...
...
@@ -81,7 +84,7 @@ subjpats = (
r
'
^subjectbounce
'
,
r
'
^returned mail
'
,
r
'
^undeliver
'
,
r
'
^delivery\b.*\bfail
ure
'
,
r
'
^delivery\b.*\bfail
'
,
r
'
^delivery problem
'
,
r
'
\buser unknown\b
'
,
r
'
^failed
'
,
...
...
@@ -1683,11 +1686,15 @@ class bmsMilter(Milter.Milter):
self
.
log
(
'
CBV:
'
,
sender
,
'
(cached)
'
)
res
=
cbv_cache
[
sender
]
else
:
self
.
log
(
'
CBV:
'
,
sender
)
fname
=
template_name
+
'
.txt
'
try
:
template
=
file
(
template_name
+
'
.txt
'
).
read
()
except
IOError
:
template
=
None
self
.
log
(
'
CBV:
'
,
sender
,
'
Using:
'
,
fname
)
except
IOError
:
template
=
None
self
.
log
(
'
CBV:
'
,
sender
,
'
PLAIN
'
)
m
=
dsn
.
create_msg
(
q
,
self
.
recipients
,
msg
,
template
)
if
m
:
if
srs
:
# Add SRS coded sender to various headers. When (incorrectly)
# replying to our DSN, any of these which are preserved
...
...
@@ -1701,6 +1708,7 @@ class bmsMilter(Milter.Milter):
m
.
add_header
(
'
Sender
'
,
'"
Python Milter
"
<%s>
'
%
msgid
)
m
=
m
.
as_string
()
print
>>
open
(
template_name
+
'
.last_dsn
'
,
'
w
'
),
m
# if missing template, do plain CBV
res
=
dsn
.
send_dsn
(
sender
,
self
.
receiver
,
m
,
timeout
=
timeout
)
if
res
:
desc
=
"
CBV: %d %s
"
%
res
[:
2
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment