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, Tickable, 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 class com.planet_ink.coffee_mud.Libraries.StdLibrary
isDebugging, name, serviceClient, tickStatus
 
Fields inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.SMTPLibrary
DEFAULT_PORT, DEFAULT_TIMEOUT, EOL
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Constructor Summary
SMTPclient()
           
SMTPclient(java.lang.String emailAddress)
           
SMTPclient(java.lang.String SMTPServerInfo, 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 fromName, java.lang.String toName, java.lang.String subj, java.lang.String msg)
           
 boolean emailIfPossible(java.lang.String SMTPServerInfo, java.lang.String from, java.lang.String replyTo, java.lang.String to, java.lang.String subject, java.lang.String message)
           
 void emailOrJournal(java.lang.String from, java.lang.String replyTo, java.lang.String to, java.lang.String subject, java.lang.String message)
           
protected  void finalize()
          close this socket Usage: finalize();
 SMTPLibrary.SMTPClient getClient(java.lang.String emailAddress)
           
 SMTPLibrary.SMTPClient getClient(java.lang.String SMTPServerInfo, 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)
           
 java.lang.String makeValidEmailAddress(java.lang.String name)
           
 void sendLine(boolean debug, java.lang.String sstr)
           
 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, checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, setThreadStatus, shutdown, tick
 
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, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, name, 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 SMTPServerInfo,
                  int port)
           throws java.net.UnknownHostException,
                  java.io.IOException
Create a SMTP object pointing to the specified host

Parameters:
SMTPServerInfo - the host to connect to.
port - the port to connect to.
Throws:
java.net.UnknownHostException - the host was unknown
java.io.IOException - a socket error

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, Tech. 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 SMTPServerInfo,
                                        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 fromName,
                               java.lang.String toName,
                               java.lang.String subj,
                               java.lang.String msg)
Specified by:
emailIfPossible in interface SMTPLibrary

emailIfPossible

public boolean emailIfPossible(java.lang.String SMTPServerInfo,
                               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

emailOrJournal

public void emailOrJournal(java.lang.String from,
                           java.lang.String replyTo,
                           java.lang.String to,
                           java.lang.String subject,
                           java.lang.String message)
Specified by:
emailOrJournal in interface SMTPLibrary

isValidEmailAddress

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

makeValidEmailAddress

public java.lang.String makeValidEmailAddress(java.lang.String name)

sendLine

public void sendLine(boolean debug,
                     java.lang.String sstr)

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 [emailaddress]\r Usage: List=Mailer.getListMembers(List);

Parameters:
list - member list
Returns:
String List of members
Throws:
java.io.IOException - a socket error
java.net.ProtocolException - an internal error

close

public void close()
close this socket Usage: this.close();


finalize

protected void finalize()
                 throws java.lang.Throwable
close this socket Usage: finalize();

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