[Twisted-Python] questions about Twisted mail

Matthew R. Scott twisted at goldenspud.com
Mon Jul 28 15:26:17 MDT 2003


Hello Twisted hackers extraordinaire!

I am evaluating the use of Twisted mail for small- to medium-sized
installations.  My goal is to get up and running with it fairly soon, with
only minor changes in the areas of email account database / authentication.

As I've been evaluating it, I have come up with a few questions regarding
 best practices for its use.

First, I'll give some background on how I am evaluating it.

Disclaimer: I know my way around "talking SMTP and POP3" on a basic level
(telnetting to a host and going through a session manually) but I am not too
familiar with the ins and outs of "talking ESMTP AUTH" yet. :)

Software
========

Mozilla 1.5a
Kmail 1.5.2
Twisted CVS 2003-07-28

Goals
=====

Ultimately, I want Twisted mail to support these outcomes from common e-mail
scenarios:

POP3 access to account: PASS
SMTP Mail from outside domain to outside domain: FAIL
SMTP Mail from outside domain to user: PASS
SMTP Mail from user to user: PASS
SMTP Mail from user to outside domain: FAIL
ESMTP Mail from user to user: PASS
ESMTP Mail from user to outside domain: PASS

mktap variations
================

I've run through several 'mktap mail' variations and these are the results
I've gathered.

In all cases, there is a 'queue' and 'test.example.com' directory in the
directory where mail.tap is created and started from.  'twistd -nof mail.tap'
is the command line used to start the mail server.

Also, when doing regular SMTP sessions, I am sending the following commands
 in a session with the SMTP server to try to send mail:

  HELO localhost
  MAIL FROM:<from at email.address>
  RCPT TO:<to at email.address>
  DATA
  testing 1 2 3
  .

(!) indicates passing when it should be failing, or failing when it should be
passing

mktap mail --maildirdbmdomain=test.example.com=test.example.com --esmtp
--user=test=1234 --default

POP3 access to account: PASS
SMTP Mail from outside domain to outside domain: PASS (!)
SMTP Mail from outside domain to user: PASS
SMTP Mail from user to user: PASS
SMTP Mail from user to outside domain: PASS (!)
ESMTP Mail from user to user: FAIL (!)
ESMTP Mail from user to outside domain: FAIL (!)

mktap mail --maildirdbmdomain=test.example.com=test.example.com --esmtp
--user=test=1234 --default --disable-anonymous

POP3 access to account: PASS
SMTP Mail from outside domain to outside domain: FAIL
SMTP Mail from outside domain to user: FAIL (!)
SMTP Mail from user to user: FAIL (!)
SMTP Mail from user to outside domain: FAIL
ESMTP Mail from user to user: FAIL (!)
ESMTP Mail from user to outside domain: FAIL (!)

Failure details for ESMTP
=========================

When I configured Mozilla's SMTP settings, it did not give me an option to
specify what kind of authentication to perform; it only allowed me to specify
whether or not a username and password were required.

This is what was in the twistd log when I tried sending using Mozilla in the
second mktap variation:

2003/07/28 16:11 CDT [twisted.mail.protocols.ESMTPFactory] Connection from
('127.0.0.1', 33291)
2003/07/28 16:11 CDT [ESMTP,0,127.0.0.1] Failure:
twisted.cred.error.UnhandledCredentials: No checker for
twisted.cred.credentials.IAnonymous ,twisted.cred.credentials.ICredentials
2003/07/28 16:11 CDT [ESMTP,0,127.0.0.1]
/home/gldnspud/p/PYTHONPATH/twisted/protocols/smtp.py:553:
exceptions.DeprecationWarning: Returning None from validateFrom is
deprecated.  Raise smtp.SMTPBadSender instead

Interestingly, in the first mktap variation, Mozilla was able to send mail
just fine, which makes me wonder if it is even using ESMTP AUTH.

When using Kmail to send mail via both variations, it complains with an
"authentication failed" message.  This was after setting the authentication
type to CRAM-MD5 and verifying that the correct username "test" was in place.
The log file from twistd shows the following:

2003/07/28 16:13 CDT [twisted.mail.protocols.ESMTPFactory] Connection from
('127.0.0.1', 33293)
2003/07/28 16:13 CDT [ESMTP,1,127.0.0.1] Failure:
twisted.cred.error.UnhandledCredentials: No checker for
twisted.cred.credentials.IUsernameHashedPassword
,twisted.cred.credentials.ICredentials


Questions
=========

Some more questions, to which I'll post my own answers if I find them out
after tinkering some more:

Are any of the problems I'm running into (such as the "No checker for
...IUsernameHashedPassword" failure) due to the transitional nature of
Twisted CVS?   (I freely admit I have not yet tried any of the above on the
last "stable" Twisted release)

Would it be easy (or at least feasible) to implement ESMTP "AUTH PLAIN" in
Twisted's SMTP server?  (I'm assuming so, since "AUTH CRAM-MD5" is already
implemented)

How close is IMAP server capability to being integrated with Twisted mail?

How would one keep usernames on different domains separate in terms of
 logging in with POP3 and authenticating with ESMTP?  E.g. "jdoe at domain1.com"
 and "jdoe at domain2.com"

What are some common configurations of Twisted mail that are currently
deployed in production environments?


Thanks,

--
Matthew R. Scott
OMAjA / http://www.omaja.com/





More information about the Twisted-Python mailing list