com.planet_ink.coffee_mud.Libraries
Class SMTPclient

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.SMTPclient
All Implemented Interfaces:
CMObject, CMLibrary, SMTPLibrary, SMTPLibrary.SMTPClient, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class SMTPclient
extends StdLibrary
implements SMTPLibrary, SMTPLibrary.SMTPClient


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.SMTPLibrary
SMTPLibrary.SMTPClient
 
Field Summary
 java.io.BufferedReader reply
          Reply buffer
 java.io.PrintWriter send
          Send writer
 java.net.Socket sock
          Socket to use
 
Fields inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.SMTPLibrary
DEFAULT_PORT, DEFAULT_TIMEOUT, EOL
 
Constructor Summary
SMTPclient()
           
SMTPclient(java.net.InetAddress address)
          Create a SMTP object pointing to the specified host
SMTPclient(java.net.InetAddress address, int port)
          Create a SMTP object pointing to the specified host
SMTPclient(java.lang.String emailAddress)
           
SMTPclient(java.lang.String hostid, int port)
          Create a SMTP object pointing to the specified host
 
Method Summary
 void close()
          close this socket

Usage: this.close();
 boolean emailIfPossible(java.lang.String SMTPServerName, java.lang.String from, java.lang.String replyTo, java.lang.String to, java.lang.String subject, java.lang.String message)
           
 void finalize()
          close this socket

Usage: finalize();
 SMTPLibrary.SMTPClient getClient(java.lang.String emailAddress)
           
 SMTPLibrary.SMTPClient getClient(java.lang.String hostid, int port)
           
 java.lang.String getListMembers(java.lang.String list)
          return members of a list on an email server.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isValidEmailAddress(java.lang.String addy)
           
 void sendMessage(java.lang.String froaddress, java.lang.String reply_address, java.lang.String to_address, java.lang.String mockto_address, java.lang.String subject, java.lang.String message)
          Send a message

Usage: Mailer.sendmsg(S, From, To, Subject, Message);
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
activate, compareTo, copyOf, getSupportThread, initializeClass, newInstance, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getSupportThread, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

reply

public java.io.BufferedReader reply
Reply buffer


send

public java.io.PrintWriter send
Send writer


sock

public java.net.Socket sock
Socket to use

Constructor Detail

SMTPclient

public SMTPclient()

SMTPclient

public SMTPclient(java.lang.String hostid,
                  int port)
           throws java.net.UnknownHostException,
                  java.io.IOException
Create a SMTP object pointing to the specified host

Parameters:
hostid - The host to connect to.
Throws:
java.net.UnknownHostException
java.io.IOException

SMTPclient

public SMTPclient(java.net.InetAddress address)
           throws java.io.IOException
Create a SMTP object pointing to the specified host

Parameters:
address - The host to connect to.
Throws:
java.io.IOException

SMTPclient

public SMTPclient(java.net.InetAddress address,
                  int port)
           throws java.io.IOException
Create a SMTP object pointing to the specified host

Parameters:
address - The host to connect to.
port - The host to connect to.
Throws:
java.io.IOException

SMTPclient

public SMTPclient(java.lang.String emailAddress)
           throws java.io.IOException,
                  BadEmailAddressException
Throws:
java.io.IOException
BadEmailAddressException
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, MiscTech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

getClient

public SMTPLibrary.SMTPClient getClient(java.lang.String hostid,
                                        int port)
                                 throws java.net.UnknownHostException,
                                        java.io.IOException
Specified by:
getClient in interface SMTPLibrary
Throws:
java.net.UnknownHostException
java.io.IOException

getClient

public SMTPLibrary.SMTPClient getClient(java.lang.String emailAddress)
                                 throws java.io.IOException,
                                        BadEmailAddressException
Specified by:
getClient in interface SMTPLibrary
Throws:
java.io.IOException
BadEmailAddressException

emailIfPossible

public boolean emailIfPossible(java.lang.String SMTPServerName,
                               java.lang.String from,
                               java.lang.String replyTo,
                               java.lang.String to,
                               java.lang.String subject,
                               java.lang.String message)
Specified by:
emailIfPossible in interface SMTPLibrary

isValidEmailAddress

public boolean isValidEmailAddress(java.lang.String addy)
Specified by:
isValidEmailAddress in interface SMTPLibrary

sendMessage

public void sendMessage(java.lang.String froaddress,
                        java.lang.String reply_address,
                        java.lang.String to_address,
                        java.lang.String mockto_address,
                        java.lang.String subject,
                        java.lang.String message)
                 throws java.io.IOException
Send a message

Usage: Mailer.sendmsg(S, From, To, Subject, Message);

Specified by:
sendMessage in interface SMTPLibrary.SMTPClient
Parameters:
froaddress - Address sending from
reply_address - Address reply to
to_address - Address sending to
mockto_address - Address sending to
subject - Subject line
message - Message content
Throws:
java.io.IOException

getListMembers

public java.lang.String getListMembers(java.lang.String list)
                                throws java.io.IOException,
                                       java.net.ProtocolException
return members of a list on an email server. 250-First Last \r

Usage: List=Mailer.getListMembers(List);

Parameters:
list - member list
Returns:
String List of members
Throws:
java.io.IOException
java.net.ProtocolException

close

public void close()
close this socket

Usage: this.close();


finalize

public void finalize()
              throws java.lang.Throwable
close this socket

Usage: finalize();

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable