1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
from twisted.application import service
application = service.Application("SMTP Client Tutorial")
from twisted.application import internet
from twisted.internet import protocol
from twisted.mail import smtp
class SMTPClientFactory(protocol.ClientFactory):
protocol = smtp.ESMTPClient
def buildProtocol(self, addr):
return self.protocol(secret=None, identity="example.com")
smtpClientFactory = SMTPClientFactory()
smtpClientService = internet.TCPClient("localhost", 25, smtpClientFactory)
smtpClientService.setServiceParent(application)
|