org.locomotive.server
Class SMTPClient

java.lang.Object
  |
  +--org.locomotive.server.SMTPClient

public class SMTPClient
extends java.lang.Object
implements java.lang.Runnable

This class can be used to have the VM deliver an email to an external SMTP server - typically UNIX sendmail.


Constructor Summary
SMTPClient(java.lang.String svrname, int svrport, java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body_text)
          Creates a new SMTPClient.
SMTPClient(java.lang.String svrname, int svrport, java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body_text, int id)
          Creates a new SMTPClient.
SMTPClient(java.lang.String svrname, int svrport, java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body_text, int id, java.lang.String helo)
          Deprecated. - This was added to get around bugs that some sites have been having, thought to be a problem with the JDK or Solaris. You probably don't need it.
SMTPClient(java.lang.String svrname, int svrport, java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body_text, int id, java.lang.String to_attach, java.lang.String filename)
          Creates a new SMTPClient, with an attachment.
 
Method Summary
 void go(Log log, boolean use_own_thread)
          Starts the delivery process.
 void run()
          required to implement Runnable, to allow sending mail messages on their own thread.
 void setTimeout(int seconds)
          set the number of seconds before the Mail client will stop trying the send the message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPClient

public SMTPClient(java.lang.String svrname,
                  int svrport,
                  java.lang.String to,
                  java.lang.String from,
                  java.lang.String subject,
                  java.lang.String body_text)
Creates a new SMTPClient.
Parameters:
svrname - the name of the SMTP server
svrport - the port the server is listening on for requests
to - the email address to send the message to
from - the email address the the message is from
subject - the subject of the message
body_text - the main text of the message

SMTPClient

public SMTPClient(java.lang.String svrname,
                  int svrport,
                  java.lang.String to,
                  java.lang.String from,
                  java.lang.String subject,
                  java.lang.String body_text,
                  int id)
Creates a new SMTPClient.
Parameters:
svrname - the name of the SMTP server
svrport - the port the server is listening on for requests
to - the email address to send the message to
from - the email address the the message is from
subject - the subject of the message
body_text - the main text of the message
id - a number to identify this client by for logging purposes

SMTPClient

public SMTPClient(java.lang.String svrname,
                  int svrport,
                  java.lang.String to,
                  java.lang.String from,
                  java.lang.String subject,
                  java.lang.String body_text,
                  int id,
                  java.lang.String helo)
Deprecated. - This was added to get around bugs that some sites have been having, thought to be a problem with the JDK or Solaris. You probably don't need it.

Creates a new SMTPClient.
Parameters:
svrname - the name of the SMTP server
svrport - the port the server is listening on for requests
to - the email address to send the message to
from - the email address the the message is from
subject - the subject of the message
body_text - the main text of the message
id - a number to identify this client by for logging purposes
helo - the name of the client host to be used for the SMTP HELO handshake. If it has the value "use_lookup" the SMTPClient will attempt a name lookup on the localhost. This is the default behavior for the other constructors.

SMTPClient

public SMTPClient(java.lang.String svrname,
                  int svrport,
                  java.lang.String to,
                  java.lang.String from,
                  java.lang.String subject,
                  java.lang.String body_text,
                  int id,
                  java.lang.String to_attach,
                  java.lang.String filename)
Creates a new SMTPClient, with an attachment. Presently, you have to read in the file yourself, then specify the file name and the contents of the file as a string. This will be eventually changed to specifying just a File object. This method of attachment does not work for binary files.
Parameters:
svrname - the name of the SMTP server
svrport - the port the server is listening on for requests
to - the email address to send the message to
from - the email address the the message is from
subject - the subject of the message
body_text - the main text of the message
id - a number to identify this client by
to_attach - the text of the attachment
filename - the name of the file the attachment text was read in from
Method Detail

setTimeout

public void setTimeout(int seconds)
set the number of seconds before the Mail client will stop trying the send the message

go

public void go(Log log,
               boolean use_own_thread)
Starts the delivery process. To avoid hanging the calling thread, use true for use_own_thread to allow asynchronous delivery "log" may be null if no logging is desired.

run

public void run()
required to implement Runnable, to allow sending mail messages on their own thread.
Specified by:
run in interface java.lang.Runnable
See Also:
go(org.locomotive.server.Log, boolean)