[Spambayes] pop3proxy now supports multiple POP3 accounts

Jeremy Hylton jeremy@alum.mit.edu
Wed Nov 20 13:13:26 2002


>>>>> "RH" == Richie Hindle <richie@entrian.com> writes:

  RH> This is now done.  It creates a listening port for each account
  RH> [I don't like the popular idea of munging the POP3 username to
  RH> include the hostname, because it complicates the proxy - simple
  RH> is good].

Oh, I see you're aware of the approach.  It's a trivial amount of code
in the proxy.  You're already using asyncore so you can't really be
worried about complexity <wink>.

It's much easier for a user to understand what's going on when the pop
client's configuration has some mention of the name of the real pop
server.  I started off uses two different servers on two different
ports, but my client never gave me any indication of where the mail
came from.  With the new change, the status line tells me what server
it's getting mail from.

The implementation is this short.  It's mostly parsing the user name
in name, host, port.

    def read_user(self):
        # XXX This could be cleaned up a bit.
        line = self.rfile.readline()
        if line == "":
            return False
        parts = line.split()
        if parts[0] != "USER":
            self.wfile.write("-ERR Invalid command; must specify USER first")
            return False
        user = parts[1]
        i = user.rfind("@")
        username = user[:i]
        server = user[i+1:]
        i = server.find(":")
        if i == -1:
            server = server, 110
        else:
            port = int(server[i+1:])
            server = server[:i], port
        zLOG.LOG("POP3", zLOG.INFO, "Got connect for %s" % repr(server))
        self.connect_pop(server)
        self.pop_wfile.write("USER %s\r\n" % username)
        resp = self.pop_rfile.readline()
        # As long the server responds OK, just swallow this reponse.
        if resp.startswith("+OK"):
            return True
        else:
            return False

Jeremy





More information about the Spambayes mailing list