<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Stuart,<br><br>Thanks for you help. Essentially I ended up adding the following to my code per you suggestion:<br><br>1) In the "hello" function:<br> self.conn_counter = None<br>2) In the "envfrom" function:<br> if self.conn_counter is None:<br> self.conn_counter = 1<br> else:<br> self.conn_counter += 1<br><br>I think added appended this value to the Milter.uniqueID when logging. It appears to do exactly what I needed.<br><br>Thanks again,<br><br>Kyle<br><br><br><div><hr id="stopSpelling">Date: Mon, 15 Aug 2011 18:06:22 -0400<br>From: stuart@bmsi.com<br>To: pymilter@bmsi.com<br>Subject: Re: [Pymilter] uniqueID()<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<title></title>
On 08/13/2011 06:44 PM, Kyle Oetken wrote:
<blockquote cite="mid:CAPv7g3cPsfizaB3ZkDffkETkrE1W6BRQh=ZA0LeBWAzF_yEObQ@mail.gmail.com">
<pre class="ecxfragment"><font size="2"><span style="font-family:verdana,sans-serif" class="ecxkeyword">In the example code this section assigns a unique ID to the milter instance:
def </span><span style="font-family:verdana,sans-serif">__init__(self): </span><span style="font-family:verdana,sans-serif" class="comment"># A new instance with each new connection.</span><span style="font-family:verdana,sans-serif">
<a href="http://self.id" target="_blank">self.id</a> = Milter.uniqueID() </span></font><span class="comment"><font size="2"><span style="font-family:verdana,sans-serif"># Integer incremented with each call.</span>
</font></span></pre>
<span class="comment"><font size="2"><span style="font-family:verdana,sans-serif">In my testing it appears that the
Milter.uniqueID appears to assign an ID to each specific tcp
connection. As a result, if multiple messages are sent over
that tcp connection each message will have the same
uniqueID. Is there a good way to assign a unique ID to a
particular message within the tcp connection? </span></font></span><br>
</blockquote>
<font size="2">You could assign an id within envfrom also (or
instead). However, since the tcp connection is a single thread,
I would recommend simply incrementing a count in envfrom (no need
for locking as with uniqueID). You can concatenate the connection
id and message index to form an id unique for that milter run.
Note that uniqueID starts over each time you start milter, it is
not something you can use for Message-ID. You could count milter
startups in a file, and prepend that to connection id and mail
from count to form a unique id.</font><br>
<br>_______________________________________________
Pymilter mailing list
Pymilter@bmsi.com
http://www.bmsi.com/mailman/listinfo/pymilter</div> </div></body>
</html>
<!DSPAM:1321E32839D15974326871816>