CMObject
, Tickable
, CMLibrary
, SMTPLibrary
, SMTPLibrary.SMTPClient
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
public class SMTPclient extends StdLibrary implements SMTPLibrary, SMTPLibrary.SMTPClient
SMTPLibrary.SMTPClient
Modifier and Type | Field | Description |
---|---|---|
java.io.BufferedReader |
reply |
Reply buffer
|
java.io.PrintWriter |
send |
Send writer
|
java.net.Socket |
sock |
Socket to use
|
idConverter
DEFAULT_PORT, DEFAULT_TIMEOUT, EOL
isDebugging, name, serviceClient, tickStatus
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_BALLISTICK, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EVENT, 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_SHORTERMASK, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
Constructor | Description |
---|---|
SMTPclient() |
|
SMTPclient(java.lang.String emailAddress) |
|
SMTPclient(java.lang.String SMTPServerInfo,
int port) |
Create a SMTP object pointing to the specified host
|
Modifier and Type | Method | Description |
---|---|---|
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) |
Attempts to send an email to the given recipient, using the INI file smtp server
if available, or directly if not.
|
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) |
Attempts to connect to the given email server and send
the given email to the given target address.
|
void |
emailOrJournal(java.lang.String from,
java.lang.String replyTo,
java.lang.String to,
java.lang.String subject,
java.lang.String message) |
Sends an email or a journal message from a variety of argument formats.
|
protected void |
finalize() |
close this socket
Usage: finalize();
|
SMTPLibrary.SMTPClient |
getClient(java.lang.String emailAddress) |
Builds an smtp client based on the given email address for a target.
|
SMTPLibrary.SMTPClient |
getClient(java.lang.String SMTPServerInfo,
int port) |
Builds an smtp client based on the given host/port info.
|
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) |
Checks the given string to see if it appears to be a valid email
address.
|
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);
|
activate, getServiceClient, L, propertiesLoaded, shutdown
copyOf, initializeClass, name, newInstance
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activate, checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, setThreadStatus, shutdown, tick
public java.io.BufferedReader reply
public java.io.PrintWriter send
public java.net.Socket sock
public SMTPclient()
public SMTPclient(java.lang.String SMTPServerInfo, int port) throws java.net.UnknownHostException, java.io.IOException
SMTPServerInfo
- the host to connect to.port
- the port to connect to.java.net.UnknownHostException
- the host was unknownjava.io.IOException
- a socket errorpublic SMTPclient(java.lang.String emailAddress) throws java.io.IOException, BadEmailAddressException
java.io.IOException
BadEmailAddressException
public java.lang.String ID()
CMObject
ID
in interface CMObject
ID
in class StdLibrary
public SMTPLibrary.SMTPClient getClient(java.lang.String SMTPServerInfo, int port) throws java.net.UnknownHostException, java.io.IOException
SMTPLibrary
getClient
in interface SMTPLibrary
SMTPServerInfo
- the smtp server host with optional override portport
- the port for the smtp serverjava.net.UnknownHostException
- the smtp host couldn't be foundjava.io.IOException
- any I/O errors that occurSMTPLibrary.getClient(String)
public SMTPLibrary.SMTPClient getClient(java.lang.String emailAddress) throws java.io.IOException, BadEmailAddressException
SMTPLibrary
getClient
in interface SMTPLibrary
emailAddress
- the email address to extract the smtp server host fromjava.io.IOException
- any I/O errors that occurBadEmailAddressException
- the email address was just badSMTPLibrary.getClient(String, int)
public boolean emailIfPossible(java.lang.String fromName, java.lang.String toName, java.lang.String subj, java.lang.String msg)
SMTPLibrary
emailIfPossible
in interface SMTPLibrary
fromName
- the from email addresstoName
- the target email address, which may be used as a direct-connect host alsosubj
- the subject of the messagemsg
- the message itselfSMTPLibrary.emailIfPossible(String, String, String, String, String, String)
,
SMTPLibrary.emailOrJournal(String, String, String, String, String)
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)
SMTPLibrary
emailIfPossible
in interface SMTPLibrary
SMTPServerInfo
- the server hostname to connect through, or null to attempt a direct transmission.from
- the from email addressreplyTo
- the reply-to email addressto
- the target email address, which may be used as a direct-connect host alsosubject
- the subject of the messagemessage
- the message itselfSMTPLibrary.emailIfPossible(String, String, String, String)
,
SMTPLibrary.emailOrJournal(String, String, String, String, String)
public void emailOrJournal(java.lang.String from, java.lang.String replyTo, java.lang.String to, java.lang.String subject, java.lang.String message)
SMTPLibrary
emailOrJournal
in interface SMTPLibrary
from
- from character name, or from email addressreplyTo
- reply to character name, or email addressto
- target to character name, or email addresssubject
- the subject of the messagemessage
- the main messageSMTPLibrary.emailIfPossible(String, String, String, String, String, String)
,
SMTPLibrary.emailIfPossible(String, String, String, String)
public boolean isValidEmailAddress(java.lang.String addy)
SMTPLibrary
isValidEmailAddress
in interface SMTPLibrary
addy
- the string to checkpublic java.lang.String makeValidEmailAddress(java.lang.String name)
public void sendLine(boolean debug, java.lang.String sstr)
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
sendMessage
in interface SMTPLibrary.SMTPClient
froaddress
- Address sending fromreply_address
- Address reply toto_address
- Address sending tomockto_address
- Address sending tosubject
- Subject linemessage
- Message contentjava.io.IOException
- any I/O errors that occurpublic java.lang.String getListMembers(java.lang.String list) throws java.io.IOException, java.net.ProtocolException
list
- member listjava.io.IOException
- a socket errorjava.net.ProtocolException
- an internal errorpublic void close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable