Setting Up

Python (smtplib)

Point a Python application's smtplib client at the gateway.

Point smtplib at the gateway's inbound server instead of your provider's own SMTP server — everything else about how your application sends mail stays the same.

STARTTLS (port 587)

import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["Subject"] = "Test"
msg["From"] = "you@yourcompany.com"
msg["To"] = "recipient@example.com"
msg.set_content("Hello from the gateway.")

with smtplib.SMTP("smtp.adlerwacht.com", 587) as server:
    server.starttls()
    server.login("you@yourcompany.com", "your-mailbox-password")
    server.send_message(msg)

Implicit SSL/TLS (port 465)

with smtplib.SMTP_SSL("smtp.adlerwacht.com", 465) as server:
    server.login("you@yourcompany.com", "your-mailbox-password")
    server.send_message(msg)
Load credentials from an environment variable or a secrets manager rather than hardcoding them in the script, especially if this code lives in a shared repository.