slimta: Mail Transfer Library¶
The slimta suite was created to provide an MTA (Mail Transfer Agent) taking advantage of new technologies and methodologies to scale horizontally in a virtualized environment. Along with that, slimta is designed to work either as a traditional application or as a software library.
News
Python Library¶
The python-slimta project is a Python library offering the building blocks necessary to create a full-featured MTA. Most MTAs must be configured, but an MTA built with python-slimta is coded. An MTA built with python-slimta can incorporate any protocol or policy – custom or built-in. An MTA built with python-slimta can integrate with other Python libraries and take advantage of Python’s great community.
import logging
from slimta.edge.smtp import SmtpEdge
from slimta.queue import Queue
from slimta.queue.dict import DictStorage
from slimta.relay.smtp.mx import MxSmtpRelay
from slimta.policy.headers import *
from slimta.policy.split import RecipientDomainSplit
logging.basicConfig(level=logging.DEBUG)
# Set up outbound delivery by MX lookup.
relay = MxSmtpRelay()
# Set up local queue storage to in-memory dictionaries.
queue_storage = DictStorage({}, {})
queue = Queue(queue_storage, relay)
queue.start()
# Ensure necessary headers are added.
queue.add_policy(AddDateHeader())
queue.add_policy(AddMessageIdHeader())
queue.add_policy(AddReceivedHeader())
queue.add_policy(RecipientDomainSplit())
# Listen for messages on port 25.
edge = SmtpEdge(('127.0.0.1', 25), queue)
edge.start()
try:
edge.get()
except KeyboardInterrupt:
print
Traditional Application¶
The slimta project is a traditional application built on top of the python-slimta library. It allows a more “out-of-the-box” MTA that offers all the useful, built-in features needed for a normal mail system setup.
process:
slimta:
daemon: false
tls:
main: &tls_main
certfile: '/path/to/cert.pem'
keyfile: '/path/to/key.pem'
edge:
outbound:
type: smtp
queue: outbound
listener:
interface: '127.0.0.1'
port: 587
tls: *tls_main
rules: !include rules.yaml
queue:
outbound:
type: memory
relay: outbound
policies:
- { type: add_date_header }
- { type: add_messageid_header }
- { type: add_received_header }
- { type: recipient_domain_split }
relay:
outbound:
type: mx
tls: *tls_main