Communication & Formats · zero-dependency · MIT

larzsmtp

Sends the raw message email.build() returns, over real SMTP.

Shells out to curl - curl has real, mature SMTP/SMTPS support, no separate mail transport agent needed, the same 'shell out to a real tool' pattern http uses for HTTP. Pairs directly with email: build the message there, hand it to smtp.send() here, or use smtp.transport(config) as email's own injectable transport so email.send(msg, config, smtp.transport(config)) just works.

larzscript pkg install smtp
View on GitHub →Learn the stack

What you get

Try it

import "smtp" as smtp
import "email" as email
let msg = email.build({"from": "a@example.com", "to": ["b@example.com"], "subject": "Hi", "text": "hello"})
let ok = smtp.send(msg, {"host": "127.0.0.1", "port": 1, "tls": false, "from": "a@example.com", "to": ["b@example.com"]})
print("send to a closed port:", ok)
let t = smtp.transport({"host": "smtp.example.com", "port": 465, "tls": true, "user": "a@example.com", "password": "secret", "from": "a@example.com", "to": ["b@example.com"]})
print("transport:", type(t))
Output
send to a closed port: false
transport: function

Why it's in the Larz Stack

larzsmtp is a real Larzscript package (larzscript pkg install smtp) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.