Jp Calderone
2003-12-30 22:16:32 UTC
I'm trying to create a mail server in Twisted.
I either get
SMTPSenderRefused
or
SMTPException: SMTP AUTH extension not supported by server.
What do I need to do to get it to work?
from twisted.internet import reactor
from twisted import mail
import twisted.mail.mail
import twisted.mail.maildir
service = mail.mail.MailService('ExampleMail')
If you want unauthenticated users to be able to send mail, you need toI either get
SMTPSenderRefused
or
SMTPException: SMTP AUTH extension not supported by server.
What do I need to do to get it to work?
from twisted.internet import reactor
from twisted import mail
import twisted.mail.mail
import twisted.mail.maildir
service = mail.mail.MailService('ExampleMail')
explicitly allow it.
from twisted.cred import checkers
service.smtpPortal.registerChecker(checkers.AllowAnonymousAccess())
smtp = service.getSMTPFactory()
SMTP AUTH is really part of ESMTP. Try service.getESMTPFactory() insteadof service.getSMTPFactory().
pop3 = service.getPOP3Factory()
domain = mail.maildir.MaildirDirdbmDomain(service, '/temp')
domain.addUser('salvador', 'gala')
service.addDomain('dali', domain)
reactor.listenTCP(25, smtp , interface='dali')
reactor.listenTCP(110, pop3 , interface='dali')
reactor.run()
Also, note that the above code accomplishes roughly the same thing as thedomain = mail.maildir.MaildirDirdbmDomain(service, '/temp')
domain.addUser('salvador', 'gala')
service.addDomain('dali', domain)
reactor.listenTCP(25, smtp , interface='dali')
reactor.listenTCP(110, pop3 , interface='dali')
reactor.run()
following command line:
mktap mail --maildirdbmdomain dali=/temp --default \
--user salvador=gala \
--pop3 110 --smtp 25
If you just want a mail server, using the command line is probably better.
If you need more flexibility than it can offer, sticking with code is the
right choice.
Jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20031230/e34026dd/attachment.pgp>