SmtpTransport
classin packageklyn.mails
public class SmtpTransport extends Object implements AutoClosable:
└ SmtpTransport
All Implemented Interfaces: AutoClosable

Stateful SMTP transport.

This transport supports:

  • plain SMTP
  • direct TLS SMTP (MailSecurity.SSL_TLS)
  • SMTP AUTH LOGIN

STARTTLS is intentionally rejected with a clear message because it requires a runtime-level TLS upgrade API that klyn.net does not expose yet.

import klyn.mails

session = Session.smtp("smtp.example.com", security=MailSecurity.SSL_TLS)
transport = session.openTransport()
Fields
Modifier and Type Member Description
public readonly session
session as Session
Session bound to this transport.
Properties
Modifier and Type Member Description
public readonly property isConnected
isConnected as Boolean:
Returns true when the underlying socket is connected.
Properties inherited from Object: type
Constructors
Modifier and Type Member Description
public SmtpTransport
SmtpTransport(session as Session):
Creates an SMTP transport.
Methods
Modifier and Type Member Description
public override close
close() as Void:
Closes the SMTP connection.
public connect
connect() as SmtpResponse throws MessagingException:
Opens the SMTP connection and performs greeting, EHLO and optional AUTH.
public deliver
deliver(message as MimeMessage) as SmtpResponse throws MessagingException:
Sends one message.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Methods inherited from AutoClosable: close