[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/master] Implement correct EmailServer.MailDelivery.receivedHeader() parsing.
commit 714c16a8f0875c23af1cb044cc46a76e5356ac6e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Wed Apr 16 22:29:23 2014 +0000
Implement correct EmailServer.MailDelivery.receivedHeader() parsing.
---
lib/bridgedb/EmailServer.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/lib/bridgedb/EmailServer.py b/lib/bridgedb/EmailServer.py
index 5d998f4..efa7514 100644
--- a/lib/bridgedb/EmailServer.py
+++ b/lib/bridgedb/EmailServer.py
@@ -432,8 +432,21 @@ class MailDelivery(object):
self.ctx = ctx
def receivedHeader(self, helo, origin, recipients):
- #XXXX what is this for? what should it be?
- return "Received: BridgeDB"
+ """Create the ``Received:`` header for an incoming email.
+
+ :type helo: tuple
+ :param helo: The lines received during SMTP client HELO.
+ :type origin: :api:`twisted.mail.smtp.Address`
+ :param origin: The email address of the sender.
+ :type recipients: list
+ :param recipients: A list of :api:`twisted.mail.smtp.User` instances.
+ """
+ cameFrom = "%s (%s [%s])" % (helo[0] or origin, helo[0], helo[1])
+ cameFor = ', '.join(["<{0}>".format(recp.dest) for recp in recipients])
+ hdr = str("Received: from %s for %s; %s" % (cameFrom, cameFor,
+ smtp.rfc822date()))
+ return hdr
+
def validateFrom(self, helo, origin):
return origin
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits