Package totalcross.net.mail
Class SMTPTransport
- java.lang.Object
-
- totalcross.net.mail.Service
-
- totalcross.net.mail.Transport
-
- totalcross.net.mail.SMTPTransport
-
- Direct Known Subclasses:
SMTPSSLTransport
public class SMTPTransport extends Transport
This class implements the Transport abstract class using SMTP for message submission and transport.- Since:
- TotalCross 1.13
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSMTPTransport(MailSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this service and terminate its connection.voidconnect()A generic connect method that takes no parameters.voidconnect(java.lang.String host, int port, java.lang.String user, java.lang.String password)voidconnect(Socket connection)protected booleanehlo()booleangetRequireStartTLS()voidissueCommand(java.lang.String cmd, int expect)protected voidprotocolConnect(java.lang.String host, int port, java.lang.String user, java.lang.String password)protected intreadServerResponse()voidsendMessage(Message message)protected intsimpleCommand(byte[] command)intsimpleCommand(java.lang.String command)protected voidstartTLS()Issue the STARTTLS command and switch the socket to TLS mode if it succeeds.booleansupportsExtension(java.lang.String ext)
-
-
-
Field Detail
-
starttls
protected static final java.lang.String starttls
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SMTPTransport
protected SMTPTransport(MailSession session)
-
-
Method Detail
-
protocolConnect
protected void protocolConnect(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws AuthenticationException, MessagingException- Overrides:
protocolConnectin classService- Throws:
AuthenticationExceptionMessagingException
-
sendMessage
public void sendMessage(Message message) throws MessagingException
- Specified by:
sendMessagein classTransport- Throws:
MessagingException
-
ehlo
protected boolean ehlo() throws MessagingException- Throws:
MessagingException
-
connect
public void connect(Socket connection) throws MessagingException
- Throws:
MessagingException
-
readServerResponse
protected int readServerResponse() throws MessagingException- Throws:
MessagingException
-
issueCommand
public void issueCommand(java.lang.String cmd, int expect) throws MessagingException- Throws:
MessagingException
-
simpleCommand
protected int simpleCommand(byte[] command) throws MessagingException- Throws:
MessagingException
-
simpleCommand
public int simpleCommand(java.lang.String command) throws MessagingException- Throws:
MessagingException
-
supportsExtension
public boolean supportsExtension(java.lang.String ext)
-
getRequireStartTLS
public boolean getRequireStartTLS()
-
connect
public void connect() throws AuthenticationException, MessagingExceptionDescription copied from class:ServiceA generic connect method that takes no parameters. Subclasses can implement the appropriate authentication schemes. Subclasses that need additional information might want to use some properties or might get it interactively. Most clients should just call this method to connect to the store.- Specified by:
connectin classService- Throws:
AuthenticationExceptionMessagingException
-
close
public void close() throws MessagingExceptionDescription copied from class:ServiceClose this service and terminate its connection. Any Messaging components (Folders, Messages, etc.) belonging to this service are invalid after this store is closed. Note that the store is closed even if this method terminates abnormally by throwing a MessagingException.- Specified by:
closein classService- Throws:
MessagingException
-
connect
public void connect(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws AuthenticationException, MessagingException- Specified by:
connectin classService- Throws:
AuthenticationExceptionMessagingException
-
startTLS
protected void startTLS() throws MessagingExceptionIssue the STARTTLS command and switch the socket to TLS mode if it succeeds.- Throws:
MessagingException
-
-