コード例 #1
0
ファイル: boot.py プロジェクト: 3nprob/Inboxen
from salmon.routing import Router
from salmon.server import LMTPReceiver, SMTPReceiver

from inboxen.router.config import settings

__all__ = ["settings"]

try:
    os.mkdir("logs", 0o700)
except OSError:
    pass

try:
    os.mkdir("run", 0o710)  # group can access files in "run"
except OSError:
    pass

logging.config.dictConfig(dj_settings.SALMON_LOGGING)

# where to listen for incoming messages
if dj_settings.SALMON_SERVER["type"] == "lmtp":
    settings.receiver = LMTPReceiver(socket=dj_settings.SALMON_SERVER["path"])
elif dj_settings.SALMON_SERVER["type"] == "smtp":
    settings.receiver = SMTPReceiver(dj_settings.SALMON_SERVER['host'],
                                     dj_settings.SALMON_SERVER['port'])

Router.load(['inboxen.router.server'])
Router.RELOAD = False
Router.LOG_EXCEPTIONS = True
Router.UNDELIVERABLE_QUEUE = queue.Queue("run/undeliverable")
コード例 #2
0
ファイル: settings.py プロジェクト: jluttine/mailserver
import json

from salmon.server import Relay, LMTPReceiver

# You may add additional parameters such as `username' and `password' if your
# relay server requires authentication, `starttls' (boolean) or `ssl' (boolean)
# for secure connections.
#
# Add these configurations to a JSON file in the directory in which Salmon is
# run and set permissions properly so the configuration is a) out of version
# control and b) not accessible to other users of the computer.

relay = Relay(debug=1, **json.load(open("relay_config.json", "r")))

receiver = LMTPReceiver(**json.load(open("receiver_config.json", "r")))

handlers = ['mailserver.app.handlers.tuhlaajapojat']

router_defaults = {'host': '.+'}
コード例 #3
0
ファイル: boot.py プロジェクト: gridl/salmon-1
import logging.config

from salmon.routing import Router
from salmon.server import Relay, LMTPReceiver
from salmon import queue

from config import settings

logging.config.fileConfig("config/logging.conf")

# the relay host to actually send the final message to
settings.relay = Relay(host=settings.relay_config['host'],
                       port=settings.relay_config['port'],
                       debug=1)

# where to listen for incoming messages
settings.receiver = LMTPReceiver(settings.receiver_config['host'],
                                 settings.receiver_config['port'])

Router.defaults(**settings.router_defaults)
Router.load(settings.handlers)
Router.RELOAD = True
Router.UNDELIVERABLE_QUEUE = queue.Queue("run/undeliverable")