smtp
Generated by tinox doc
tinox.core.smtp, split out of the bundled stdlib as a standalone tinox-central package.
Send email
import tinox.core.smtp
class Main
{
fnc main() -> Int32
{
let client: SmtpClient = SmtpClient::connect("smtp.example.org", 587)
if (client.conn <= 0)
{
println("connect failed: " + client.errorMessage)
return 1
}
if (!client.startTls())
{
println("STARTTLS failed")
return 1
}
if (!client.authPlain("user", "pass"))
{
println("auth failed")
return 1
}
client.send("me@example.org", ["you@example.org"], "Hi", "Hello from Tinox!")
client.close()
return 0
}
}
fn httpConnReadLine(conn: Int64) → String
fn httpConnTakeFd(conn: Int64) → Int64
class SmtpClient
Fields
conn | Int64 | |
host | String | |
errorMessage | String |
Methods
fn connect(host: String, port: Int64) → SmtpClient
fn connectTls(host: String, port: Int64, verify: Bool) → SmtpClient
fn finishConnect(conn: Int64, host: String) → SmtpClient
fn ehlo() → Bool
fn startTls() → Bool
fn authPlain(user: String, pass: String) → Bool
fn send(from: String, to: List<String>, subject: String, body: String) → Bool
fn close() → Nothing
fn readReply(conn: Int64) → String