<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Il 06/11/13 12:09, Stacey Sern ha
scritto:<br>
</div>
<blockquote
cite="mid:0D7D5E1F-BD46-4FAC-B244-5838F336F33B@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hi,
<div><br>
</div>
<div>I also tried to figure out how to deliver one copy of a
message instead of one for every recipient for a Twisted server
tutorial (ticket #3324) which hasn't yet been finalized. Here's
the way I went about it but I'd appreciate comments on the
approach as well.</div>
<div><br>
</div>
<div>For the IMessageDelivery.validateTo method, it generates the
real IMessage object when it receives the first recipient.
After that, it returns a NullMessage object for each subsequent
recipient. The NullMessage object is called for each line
received as part of the message but does nothing with it. Then
you don't need to change _cbToValidate. Here's you're code with
the modifications <a moz-do-not-send="true"
href="http://pastebin.com/6nFXiTgK">http://pastebin.com/6nFXiTgK</a>.</div>
<div><br>
</div>
<div>Stacey</div>
</blockquote>
Hi Stacey,<br>
thanks for your reply.<br>
<br>
I think your approach is cleaner than mine! Thanks!<br>
My only concern is this loop in smtp.SMTP.do_DATA:<br>
<br>
for (user, msgFunc) in recipients:<br>
[...]<br>
<br>
that implies a scan of the whole list of messages (made of the
'real' message and of the other NullMessages).<br>
I don't know how it can really impact on performances, though. I
aimed at not creating 'fake' messages at all, but it's not clear to
me if it's even possible without overriding _cbToValidate.<br>
<br>
Let's keep in touch!<br>
<br>
Fabio<br>
<blockquote
cite="mid:0D7D5E1F-BD46-4FAC-B244-5838F336F33B@gmail.com"
type="cite">
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Nov 6, 2013, at 5:08 AM, Fabio Sangiovanni <<a
moz-do-not-send="true" href="mailto:sangiovanni@nweb.it">sangiovanni@nweb.it</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000"> Hello list,<br>
<br>
I'm new to twisted and to python in general, so still deep
in the learning process.<br>
Please forgive any faulty assumptions you'll find in this
post :)<br>
<br>
I'm trying to accomplish to the following task: realize a
tool that acts as a proxy between the SMTP domain and the
'objects' domain. That is: a daemon that listens for SMTP
connections (relayed sessions from Postfix) and bundles
everything that belongs to a single session (envelope
sender, envelope recipients, headers, body) into an object
(it will probably become a JSON one day, not decided yet).
The aim is to allow further processing (es. publishing to
a queue) of a self-contained item.<br>
<br>
My (draft) implementation can be reached at <a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://pastebin.com/mbRztuid">http://pastebin.com/mbRztuid</a><br>
<br>
My main concerns are:<br>
1) am I using the right classes? My implementation
leverages twisted.mail.smtp, is this correct?<br>
2) I've overridden smtp.SMTP.<span style="font-family:
Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation
Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono',
monospace, serif; font-size: 12px; font-style: normal;
font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 21px; text-align:
left; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color:
rgb(255, 255, 255); display: inline !important; float:
none; "></span><span class="me1" style="font-family:
Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation
Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono',
monospace, serif; font-size: 12px; font-style: normal;
font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 21px; text-align:
left; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; "></span>_cbToValidate;
I really don't like this very much (I'd like to leave the
protocol untouched) but it's the only way I've come up
with (after several days of experiments :) ) to have one
single payload down the line (in smtp.SMTP.do_DATA), and
not one copy of the message for every single recipient.
May this have bad consequences?<br>
3) what do you think about the overall approach? could it
have been done differently/better?<br>
<br>
Thanks a lot for your help!<br>
<br>
Fabio<span style="font-family: Consolas, Menlo, Monaco,
'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono',
'Bitstream Vera Sans Mono', monospace, serif; font-size:
12px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: 21px; text-align: left; text-indent: 0px;
text-transform: none; white-space: normal; word-spacing:
0px; -webkit-text-stroke-width: 0px; background-color:
rgb(255, 255, 255); display: inline !important; float:
none; "></span> </div>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a moz-do-not-send="true"
href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Twisted-Python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>
</pre>
</blockquote>
<br>
</body>
</html>