On 03/14/2014 02:42 PM, Yan Juras wrote: > > I was looking at the Spamcop FAQ and noticed a brief comment about the > Received headers that some webmail interfaces add that list the IP address of > the client that used HTTP to submit the email via a webmail GUI, for example: > > Received: from 66.191.176.186 by webmail-d137.sysops.aol.com (149.174.18.27) > with HTTP (WebMailUI); Sat, 13 Apr 2013 08:07:55 -0400 > > The Spamcop FAQ kind of implies that Spamcop will consider the source of the > HTTP (in this example, 66.191.176.186) as the sender, rather than the email > server that converted the HTTP to SMTP. I've not checked this at all, so I > may be reading into the FAQ. > > So my question is this: can Mailman be configured in some straightforward way > to add a Received: header with the IP address of the host that requested the > subscription? I am not a Python programmer, but I am capable of making code > changes if necessary.
Received: headers and the circumstances in which they are added are defined by RFC 5321 and its predecessors. They are to be added at the beginning of the headers by servers that relay the message. The implication is that the agent that generates the message (Mailman in this case) should not be including a Received: header in the generated message, but you could do it. The attached patch is an example of how this could be done. Note that the Received: header is inserted at the front of the msg._headers list rather than setting it in the normal way which would add it at the end. -- Mark Sapiro <m...@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
--- ../2.1/Mailman/MailList.py 2013-09-28 14:35:25.049175848 -0700 +++ Mailman/MailList.py 2014-03-15 10:02:56.659744673 -0700 @@ -897,9 +897,16 @@ # accept a userdesc instance. cookie = self.pend_new(Pending.SUBSCRIPTION, userdesc) # Send the user the confirmation mailback + rcvd = None if remote is None: by = remote = '' else: + if re.match(r'^\d+\.\d+\.\d+\.\d+$', remote): + rcvd = 'from %s by %s with HTTP; %s' % ( + remote, + self.host_name, + time.strftime('%a, %d %b %Y %X %z'), + ) by = ' ' + remote remote = _(' from %(remote)s') @@ -932,6 +939,8 @@ autosub = 'auto-generated' del msg['auto-submitted'] msg['Auto-Submitted'] = autosub + if rcvd: + msg._headers.insert(0, ('Received', rcvd)) msg.send(self) who = formataddr((name, email)) syslog('subscribe', '%s: pending %s %s',
------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/archive%40jab.org