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)
  • mandatory SMTP TLS upgrade (MailSecurity.STARTTLS)
  • SMTP AUTH LOGIN

Credentials are never sent over an unencrypted SMTP connection.

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.
Inherited Properties
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public SmtpTransport 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.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml
methodInherited Methods from AutoClosable: close