SmtpMail

public class SmtpMail

A class that handles sending SMTP messages.

Author:Administrator

Constructors

SmtpMail

public SmtpMail(boolean useSSL)

Create a new SmtpMail instance.

Parameters:
  • useSSL
Throws:
  • SmtpMailException

SmtpMail

public SmtpMail(SmtpMailProperties sprops, boolean useSSL)

Create a new SmtpMail instance with the given SmtpMailProperties object.

Parameters:
  • sprops
  • useSSL
Throws:
  • SmtpMailException

Methods

getSession

public Session getSession()

isConnected

public boolean isConnected()

Checks whether the transport associated with this instance is connected.

Returns:boolean

send

public void send(SMTPMessage msg, Address[] to)

Send the SMTPMessage to the address(es) using the SMTP transport

Parameters:
  • msg
  • to
Throws:

send

public void send(String source, Address from, Address[] to, String subject)

Convenience method for composing a simple text MIME Message with the source.

Parameters:
  • source
  • from
  • to
  • subject
Throws:

transportClose

public void transportClose()

Attempts to close the transport connection. If the transport is not connected, will not do anything.

Throws:

transportConnect

public void transportConnect()

Attempts to connect the smtp transport object using the default values from the session.

Throws:

transportConnect

public void transportConnect(String host, int port, String password, String username)

Attempts to connect the smtp transport object. Use -1 for the default port, and null for the default values from the session.

Throws: