-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
31 lines (21 loc) · 986 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from twisted.internet import reactor
import sys
from pyMail.database import database
from pyMail.logging import console
from pyMail.config import config
db = database.instance()
config = config(db)
if ( config.services['smtp']['on'] ):
from pyMail.smtp import queue, delivery, protocol
console.log('Starting SMTP on port %s' % (config.services['smtp']['port']))
deliv = delivery.deliveryAgent(db.messages)
queue = queue.queue(db.queue, deliv)
queue.restore()
reactor.listenTCP(config.services['smtp']['port'], protocol.serverFactory(config.services['smtp'], queue))
if ( config.services['smtps']['on'] ):
reactor.listenSSL(config.services['smtps']['port'], protocol.serverFactory(config.services['smtps'], queue))
if ( config.services['imap']['on'] ):
from pyMail.imap import protocol
console.log('Starting IMAP on port %s' % config.services['imap']['port'])
reactor.listenTCP(config.services['imap']['port'], protocol.serverFactory(config))
reactor.run()