- Member Milter.dictfromlist (args)
- You probably want Milter.param2dict instead.
- Class Milter.test.TestBase
- Use Milter.test.TestCtx
def _feedMsg(self, fname, sender="spam@adv.com", *rcpts)
Feed an email contained in a file to the milter.
Definition: testctx.py:310
def abort(self)
Called when the connection is abnormally terminated.
Definition: __init__.py:450
_priv
Usually the Milter application derived from Milter.Base.
Definition: testctx.py:27
greylist_time
Definition: greylist.py:39
def setliteral(self, *args)
Definition: sgmllib.py:87
rawdata
Definition: sgmllib.py:73
def _setctx(self, ctx)
Attach this Milter to the low level milter.milterContext object.
Definition: __init__.py:269
def handle_special(self, data)
Definition: mime.py:379
def settimeout(secs)
Set timeout for MTA communication.
Definition: milter.py:203
def log(self, *msg)
Defined by subclasses to write log messages.
Definition: __init__.py:312
lasttag
Definition: sgmllib.py:75
_delrcpt
List of recipients deleted.
Definition: testctx.py:29
Enhance email.message.Message.
Definition: mime.py:92
def parse_starttag(self, i)
Definition: sgmllib.py:237
def get_payload(self, i=None, decode=False)
Definition: mime.py:196
def _eom(self)
Definition: testctx.py:257
def handle_endtag(self, tag, method)
Definition: sgmllib.py:383
_reply
Reply codes and messages set by the milter.
Definition: testctx.py:35
_body
The message body.
Definition: test.py:33
def getsymval(self, sym)
Calls smfi_getsymval.
Definition: milter.py:79
def envrcpt(self, to, *str)
Called when the SMTP client says RCPT TO.
Definition: __init__.py:722
def close(self)
Called when the connection is closed.
Definition: __init__.py:749
def unquote(s)
Definition: mime.py:63
_headerschanged
True if the milter changed any headers.
Definition: testctx.py:43
def _envrcpt(self, s)
Definition: testctx.py:205
greylist_time
Definition: greysql.py:19
def setsymlist(self, stage, *macros)
Tell the MTA which macro names will be used.
Definition: __init__.py:558
def uniqueID()
Definition: __init__.py:30
def addrcpt(self, rcpt, params=None)
Calls smfi_addrcpt.
Definition: milter.py:94
def feedFile(self, fp, sender="spam@adv.com", rcpt="victim@lamb.com", *rcpts)
Feed a file like object to the milter.
Definition: test.py:161
def __call__(self, msg, savname=None, check=check_ext, scan_rfc822=True, scan_zip=False)
Definition: mime.py:322
def data(self)
Called when the SMTP client says DATA.
Definition: __init__.py:405
def connect(self, hostname, family, hostaddr)
Called for each connection to the MTA.
Definition: __init__.py:701
firstseen
Definition: greylist.py:24
def abort(self)
Called when the connection is abnormally terminated.
Definition: __init__.py:744
def parse_header(val)
Decode headers gratuitously encoded to hide the content.
Definition: utils.py:204
def handle_data(self, data)
Definition: sgmllib.py:438
def set_abort_callback(cb)
Definition: milter.py:137
Test mixin for unit testing milter applications.
Definition: test.py:19
def convert_entityref(self, name)
Definition: sgmllib.py:417
submsg
Definition: mime.py:97
def set_close_callback(cb)
Definition: milter.py:138
def envcallback(c, args)
Definition: __init__.py:816
basename
Definition: plock.py:11
def header(self, field, value)
Called for each header field in the message body.
Definition: __init__.py:728
def feedMsg(self, fname, sender="spam@adv.com", *rcpts)
Feed an email contained in a file to the milter.
Definition: test.py:220
def finish_starttag(self, tag, attrs)
Definition: sgmllib.py:330
factory
The milter connection factory This factory method is called for each connection to create the python ...
Definition: __init__.py:762
lastseen
Definition: greylist.py:25
def noreply(func)
Function decorator to disable callback reply.
Definition: __init__.py:166
sender
Definition: policy.py:29
def symlist(*syms)
Function decorator to set macros used in a callback.
Definition: __init__.py:215
def header(self, field, value)
Called for each header field in the message body.
Definition: __init__.py:431
def progress(self)
Reset activity timer.
Definition: testctx.py:141
def stop()
Stop the milter gracefully.
Definition: milter.py:230
def delrcpt(self, rcpt)
Delete a recipient from the message.
Definition: __init__.py:632
def zipnames(txt)
Return a list of filenames in a zip file.
Definition: mime.py:39
def set_connect_callback(cb)
Definition: milter.py:130
lock
Definition: greylist.py:43
ignoring
Definition: mime.py:422
def getpriv(self)
Return the Python object attached to this connection context.
Definition: milter.py:103
def enable_protocols(klass, mask)
Class decorator to enable optional protocol steps.
Definition: __init__.py:94
scan_rfc822
Definition: mime.py:327
def negotiate_callback(ctx, opts)
Connect context to connection instance and return enabled callbacks.
Definition: __init__.py:766
def lock(self, lockname=None, mode=0o660, strict_perms=False)
Definition: plock.py:14
literal
Definition: sgmllib.py:77
def setdbg(lev)
Set the libmilter debugging level.
Definition: milter.py:198
modified
Definition: mime.py:98
age
Definition: cache.py:57
def setreply(self, rcode, xcode, *msg)
Save the reply codes and messages in self._reply.
Definition: test.py:125
testdata
Definition: sgmllib.py:463
def protocol_mask(klass)
Return mask of SMFIP_N* protocol option bits to clear for this class The @nocallback and @noreply dec...
Definition: __init__.py:465
def close(self)
Definition: sgmllib.py:510
def set_eoh_callback(cb)
Definition: milter.py:135
def addr2bin(s)
Definition: utils.py:33
def _abort(self)
Definition: testctx.py:144
def chgfrom(self, sender, params=None)
Change the SMTP envelope sender address.
Definition: __init__.py:663
def runmilter(name, socketname, timeout=0, rmsock=True)
Run the milter.
Definition: __init__.py:835
def get(self, sect, opt, fallback=None, **kwds)
Definition: config.py:17
def chgfrom(self, sender, param=None)
Calls smfi_chgfrom.
Definition: milter.py:109
def _close(self)
Definition: testctx.py:149
def set_body_callback(cb)
Definition: milter.py:136
scan_zip
Definition: mime.py:328
stack
Definition: sgmllib.py:74
def connect(self, hostname, family, hostaddr)
Called for each connection to the MTA.
Definition: __init__.py:344
Milter context for unit testing milter applications.
Definition: testctx.py:23
def dump(self, file, unixfrom=False)
Definition: mime.py:159
def goahead(self, end)
Definition: sgmllib.py:115
def DNSLookup(name, qtype)
Lookup DNS records by label and RR type.
Definition: dns.py:16
def create_msg(v, rcptlist=None, origmsg=None, template=None)
Definition: dsn.py:171
def getversion()
Retrieve the runtime libmilter version.
Definition: milter.py:244
def _envfrom(self, *s)
Definition: testctx.py:196
def reset(self)
Definition: sgmllib.py:70
A do "nothing" Milter base class representing an SMTP connection.
Definition: __init__.py:265
fp
Definition: plock.py:12
logfp
Definition: test.py:23
def log(self, *msg)
Definition: test.py:54
def rejected_recipients(klass)
Milter rejected recipients.
Definition: __init__.py:112
def _close(self)
Definition: test.py:49
def dictfromlist(args)
Convert ESMTP parameters with values to a keyword dictionary.
Definition: __init__.py:795
def getdiag()
Retrieve diagnostic info.
Definition: milter.py:237
def negotiate(self, opts)
Negotiate milter protocol options.
Definition: __init__.py:493
def close_callback(ctx)
Disconnect milterContext and call close method.
Definition: __init__.py:784
_delrcpt
List of recipients deleted.
Definition: test.py:27
def handle_pi(self, data)
Definition: sgmllib.py:450
def chgheader(self, name, idx, value)
Calls smfi_chgheader.
Definition: milter.py:92
def set_header_callback(cb)
Definition: milter.py:134
def setreply(self, rcode, xcode, *msg)
Calls smfi_setreply or smfi_setmlreply.
Definition: milter.py:88
def flush(self)
Definition: sgmllib.py:471
def bin2long6(s)
Definition: utils.py:45
_addrcpt
List of recipients added.
Definition: testctx.py:31
def replacebody(self, body)
Replace the message body.
Definition: __init__.py:646
def setreply(self, rcode, xcode=None, msg=None, *ml)
Set the SMTP reply code and message.
Definition: __init__.py:538
_headerschanged
True if the milter changed any headers.
Definition: test.py:37
def unknown_charref(self, ref)
Definition: sgmllib.py:456
_protocol
A bitmask of protocol options this connection has negotiated.
Definition: __init__.py:307
Definition: greylist.py:19
_activity
Last activity.
Definition: testctx.py:55
def convert_codepoint(self, codepoint)
Definition: sgmllib.py:402
def parse_endtag(self, i)
Definition: sgmllib.py:310
def decode(s, convert_eols=None)
Fix email.base64mime.decode to add any missing padding.
Definition: utils.py:161
def decode(strategy)
Function decorator to set decoding error strategy.
Definition: __init__.py:204
def handle_entityref(self, name)
Definition: sgmllib.py:429
_symlist
The macros returned by protocol stage.
Definition: testctx.py:37
_reply
Reply codes and messages set by the milter.
Definition: test.py:41
def setconn(s)
Set the socket used to communicate with the MTA.
Definition: milter.py:227
def check_attachments(msg, check, lev=None)
Definition: mime.py:286
def _helo(self, helo)
Definition: testctx.py:186
def _feedFile(self, fp, sender="spam@adv.com", rcpt="victim@lamb.com", *rcpts)
Feed a file like object to the ctx.
Definition: testctx.py:269
def send_dsn(mailfrom, receiver, msg=None, timeout=600, session=None, ourfrom='')
Send DSN.
Definition: dsn.py:96
_sender
The MAIL FROM for the current email being fed to the milter.
Definition: testctx.py:47
def unknown_endtag(self, tag)
Definition: sgmllib.py:455
def quarantine(self, reason)
Quarantine the message.
Definition: __init__.py:677
cache
Definition: dns.py:36
def __init__(self, verbose=0)
Definition: sgmllib.py:462
_envfromchanged
True if the milter changed the envelope from.
Definition: test.py:39
A logging but otherwise do nothing Milter base class.
Definition: __init__.py:691
def set_envrcpt_callback(cb)
Definition: milter.py:133
def _eoh(self)
Definition: testctx.py:239
cache
Definition: cache.py:58
_addrcpt
List of recipients added.
Definition: test.py:29
_protocol
Definition: test.py:22
def getencoding(self)
Definition: mime.py:170
def _data(self)
Definition: testctx.py:213
def __getitem__(self, sender)
Definition: cache.py:127
Provide a higher level interface to pydns.
Definition: dns.py:1
_stage
Definition: testctx.py:157
_sender
The MAIL FROM for the current email being fed to the milter.
Definition: test.py:25
scan_html
Definition: mime.py:310
def quarantine(self, reason)
Calls smfi_quarantine.
Definition: milter.py:105
Definition: greysql.py:15
def _convert_ref(self, match)
Definition: sgmllib.py:299
def has_key(self, sender)
Definition: cache.py:115
def set_envfrom_callback(cb)
Definition: milter.py:132
def delrcpt(self, rcpt)
Calls smfi_delrcpt.
Definition: milter.py:96
use_nulls
Definition: policy.py:28
defaults
Definition: config.py:11
_ctx
The low level milter.milterContext object.
Definition: __init__.py:271
def parse_addr(t)
Definition: utils.py:171
def inet_ntop(s)
Definition: pyip6.py:16
entitydefs
Definition: sgmllib.py:414
_body
The message body.
Definition: testctx.py:39
def hello(self, hostname)
Called when the SMTP client says HELO.
Definition: __init__.py:707
def setsymlist(self, stage, macrolist)
Tell the MTA which macro values we are interested in for a given stage.
Definition: milter.py:118
entity_or_charref
Definition: sgmllib.py:61
Definition: greylist.py:35
def progress(self)
Tell the MTA to wait a bit longer.
Definition: __init__.py:685
def set_payload(self, val, charset=None)
Definition: mime.py:207
def _negotiate(self)
Definition: testctx.py:152
msg
Definition: mime.py:424
def parse_pi(self, i)
Definition: sgmllib.py:221
def message_from_file(fp)
Definition: mime.py:235
_bodyreplaced
True if the milter replaced the message body.
Definition: test.py:35
__starttag_text
Definition: sgmllib.py:72
def progress(self)
Calls smfi_progress.
Definition: milter.py:107
def register(name, negotiate=None, unknown=None, data=None)
Register python milter with libmilter.
Definition: milter.py:174
Definition: sgmllib.py:59
_macros
Macros defined.
Definition: test.py:31
def addheader(self, field, value, idx=-1)
Add a mail header field.
Definition: __init__.py:585
def close(self)
Definition: sgmllib.py:105
Definition: sgmllib.py:43
greylist_retain
Definition: greylist.py:41
_envfromchanged
True if the milter changed the envelope from.
Definition: testctx.py:49
def eom(self)
Called at the end of the message body.
Definition: __init__.py:739
def addrcpt(self, rcpt, params=None)
Add a recipient to the message.
Definition: __init__.py:618
headerchange
Provide a headerchange event for integration with Milter.
Definition: mime.py:104
dbp
Definition: greylist.py:42
_savname
Definition: mime.py:325
Fix multipart handling in email.Generator.
Definition: mime.py:51
def setsymval(self, name, val)
Set a macro value.
Definition: test.py:62
def finish_shorttag(self, tag, data)
Definition: sgmllib.py:323
def feed(self, data)
Definition: sgmllib.py:94
Definition: milter.py:120
_protocol
Definition: testctx.py:164
lockname
Definition: plock.py:19
_msg
The rfc822 message object for the current email being fed to the milter.
Definition: test.py:43
def main()
Transfer control to libmilter.
Definition: milter.py:190
def setpriv(self, priv)
Attach a Python object to this connection context.
Definition: milter.py:101
modified
Definition: mime.py:423
def log(self, *msg)
Provide simple logging to sys.stdout.
Definition: __init__.py:695
def handle_charref(self, name)
Definition: sgmllib.py:405
def _chk_name(self, msg)
Definition: mime.py:312
def param2dict(str)
Convert ESMTP parm list to keyword dictionary.
Definition: __init__.py:809
greylist_retain
Definition: greysql.py:21
def hello(self, hostname)
Called when the SMTP client says HELO.
Definition: __init__.py:349
umis
Definition: greylist.py:27
fname
Definition: cache.py:59
def body(self, blk)
Called to supply the body of the message to the Milter by chunks.
Definition: __init__.py:438
def setnomoretags(self)
Definition: sgmllib.py:80
def dns(self, name, qtype, cnames=None)
Cached DNS lookup.
Definition: dns.py:60
def finish_endtag(self, tag)
Definition: sgmllib.py:348
def unknown_starttag(self, tag, attrs)
Definition: sgmllib.py:454
domain
Definition: policy.py:30
def set_helo_callback(cb)
Definition: milter.py:131
def nocallback(func)
Function decorator to disable callback methods.
Definition: __init__.py:145
def header_leading_space(klass)
Milter leading space on headers.
Definition: __init__.py:133
_macros
Macros defined.
Definition: testctx.py:33
def envfrom(self, f, *s)
Called when the SMTP client says MAIL FROM.
Definition: __init__.py:374
def __init__(self, verbose=0)
Definition: sgmllib.py:65
def replacebody(self, data)
Calls smfi_replacebody.
Definition: milter.py:98
_bodyreplaced
True if the milter replaced the message body.
Definition: testctx.py:41
ignoreLastByte
Definition: greysql.py:18
def set_flags(flags)
Enable optional milter actions.
Definition: milter.py:128
_stage
The protocol stage for macros returned.
Definition: test.py:45
def eoh(self)
Called at the blank line that terminates the header fields.
Definition: __init__.py:434
_msg
The rfc822 message object for the current email being fed to the milter.
Definition: testctx.py:45
def iniplist(ipaddr, iplist)
Definition: utils.py:64
_symlist
The macros returned by protocol stage.
Definition: test.py:47
Definition: sgmllib.py:460
def handle_starttag(self, tag, method, attrs)
Definition: sgmllib.py:379
def convert_charref(self, name)
Definition: sgmllib.py:392
def _feed_body(self, bfp)
Definition: testctx.py:247
def envrcpt(self, to, *str)
Called when the SMTP client says RCPT TO.
Definition: __init__.py:399
Disabled action exception.
Definition: __init__.py:232
def parseaddr(t)
Split email into Fullname and address.
Definition: utils.py:125
_actions
A bitmask of actions this connection has negotiated to use.
Definition: __init__.py:286
header_bytes
Definition: __init__.py:422
access_file
Definition: policy.py:32
def addheader(self, name, value, idx=-1)
Calls smfi_addheader.
Definition: milter.py:90
greylist_expire
Definition: greysql.py:20
def report_unbalanced(self, tag)
Definition: sgmllib.py:387
acf
Definition: policy.py:31
ignoreLastByte
Definition: greylist.py:38
conn
Definition: greysql.py:22
def opensocket(rmsock)
Attempt to create the socket used to communicate with the MTA.
Definition: milter.py:185
def getnames(self, scan_zip=False)
Definition: mime.py:124
def connect(self, host='localhost', helo='spamrelay', ip='1.2.3.4')
Call the connect and helo callbacks.
Definition: test.py:229
_check
Definition: mime.py:326
def unlock(self)
Definition: plock.py:59
def unknown(self, cmd)
Called when the SMTP client issues an unknown command.
Definition: __init__.py:443
def _header(self, fld, val)
Definition: testctx.py:221
def connect_callback(ctx, hostname, family, hostaddr, nr_mask=P_NR_CONN)
Connect context if needed and invoke connect method.
Definition: __init__.py:773
cnt
Definition: greylist.py:26
def error(self, message)
Definition: sgmllib.py:109
out
Definition: mime.py:353
def getsymval(self, sym)
Return the value of an MTA macro.
Definition: __init__.py:518
def setbacklog(n)
Set socket backlog.
Definition: milter.py:208
def inet_pton(p)
Definition: pyip6.py:59
def unknown_entityref(self, ref)
Definition: sgmllib.py:457
verbose
Definition: sgmllib.py:67
def get_param(self, param, failobj=None, header='content-type', unquote=True)
Definition: mime.py:106
def eoh(self)
Called at the blank line that terminates the header fields.
Definition: __init__.py:734
def envfrom(self, f, *str)
Definition: __init__.py:713
def chgheader(self, field, idx, value)
Change the value of a mail header field.
Definition: __init__.py:599
Hold context for a milter connection.
Definition: milter.py:77
def set_exception_policy(code)
Sets the return code for untrapped Python exceptions during a callback.
Definition: milter.py:148
greylist_expire
Definition: greylist.py:40
nomoretags
Definition: sgmllib.py:76
def has_precise_key(self, sender)
Definition: cache.py:101
_opts
Negotiated options.
Definition: testctx.py:53