All Packages Class Hierarchy This Package Previous Next Index
Class ProtocolLayer.SMTPThread
Abstract.Connection
|
+----Abstract.ReceiverThread
|
+----BaseLayer.BRecvThread
|
+----ProtocolLayer.IPThread
|
+----ProtocolLayer.SMTPThread
- public class SMTPThread
- extends IPThread
Example class of extending IPThread(Internet protocol thread).
-
SMTPThread()
- Default Constructor.
-
SMTPThread(Address, Address, String, ThreadGroup)
- Constructor, performing the simplest mail transfer.
-
SMTPThread(Address, int, String, String, String, ThreadGroup)
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address.
-
SMTPThread(Address, int, String, String[], String, ThreadGroup)
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address.
-
SMTPThread(SMTPCon, int, ThreadGroup)
- Can be used both for applets and stand-alone agents, but for efficiency, normally
used for applets.
-
SMTPThread(String)
- Create ReceiverThread with specific thread name
-
SMTPThread(String, String, String, ThreadGroup)
- Constructor, performing the simplest mail transfer.
-
SMTPThread(String, String[], String, ThreadGroup)
- Constructor, performing the simplest mail transfer.
-
SMTPThread(String, ThreadGroup)
- For simplicity.
-
SMTPThread(String, Vector, ThreadGroup)
- For simplicity.
-
SMTPThread(ThreadGroup, String)
- Create ReceiverThread with specific thread name and Thread group.
-
getEmailAddress(Address)
- Get email address from Address object
-
makeSimpleCommandList()
- Make command list from given sender, receiver and mail.
-
notifyError(String)
- Notify error if _ipAgentAction(class IPRouterClientAction) is not null
-
notifyMessage()
- Notify message(FTPCon itself) if _ipAgentAction(class IPRouterClientAction) is not null
_ipAgentAction will invoke processMessage(String,Object) where String is "SMTP" and
Object is _smtpCon.
-
processCommands()
- processCommands implementation.
-
processErrorMsg(String)
- According to the response from mail server, return false if the error message
can not be managed.
SMTPThread
public SMTPThread()
- Default Constructor.
SMTPThread
public SMTPThread(String name)
- Create ReceiverThread with specific thread name
- Parameters:
- name - Agent name
SMTPThread
public SMTPThread(ThreadGroup tg,
String name)
- Create ReceiverThread with specific thread name and Thread group.
Passing thread group is essential when you will create the receiver thread for an applet
because of security issue.
- Parameters:
- tg - Thread group to which this thread will be owned to
- name - Agent name
SMTPThread
public SMTPThread(SMTPCon con,
int priority,
ThreadGroup tg) throws ConnectionException
- Can be used both for applets and stand-alone agents, but for efficiency, normally
used for applets. Router will create a connector which connects an applet and SMTP
server. Through the connector, email will be sent as if the applet is a stand-aloone
agent.
- Parameters:
- con - SMTPCon object which contains proxy server(router) internet address and
connector port, my email address, receiver email address, email data and command list
- priority - Thread priority. Default is NORM_PRIORITY
- tg - Thread group, the thread will be grouped.
- Throws: Throws
- ConnectionException if connection error occurs.
SMTPThread
public SMTPThread(Address serveraddress,
int priority,
String myEmail,
String receiverEmail,
String data,
ThreadGroup tg) throws ConnectionException
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address. 'security' object will be used to
satisfy connection protocol to server. This constructor will be called when
an agent use JATLite router as a proxy. Do not use this constructor when the agent
is a stand-alone agent which has capability to connect email server directly.
For serveraddress parameter, host should be the router host name and port should
be a port, specified by the router. If you need to more advanced command list
other than provided by default, you can pass command list as a parameter, If it is null,
default simple command list will be assumed.
- Parameters:
- serveraddress - The address of the remote host(Proxy address, not an actual email server).
- priority - The priority of the thread.
- myEmail - My email address.
- receiverEmail - Receiver email address.
- data - Email content.
- cmdlist - Command list. If null, default simple command list will be applied
- tg - Thread group
- Throws: ConnectionException
- if error occurs
SMTPThread
public SMTPThread(Address serveraddress,
int priority,
String myEmail,
String receiverEmails[],
String data,
ThreadGroup tg) throws ConnectionException
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address. 'security' object will be used to
satisfy connection protocol to server. This constructor will be called when
an agent use JATLite router as a proxy. Do not use this constructor when the agent
is a stand-alone agent which has capability to connect email server directly.
For serveraddress parameter, host should be the router host name and port should
be a port, specified by the router. If you need to more advanced command list
other than provided by default, you can pass command list as a parameter, If it is null,
- Parameters:
- serveraddress - The address of the remote host. Host will be the same as router,
and port will be given from the router.
- priority - The priority of the thread.
- myaddress - My address.
- connections - the connection table is passed as an argument.
- queue - the Message Queue.
- security - The security object
- Throws: ConnectionException
- if error occurs
SMTPThread
public SMTPThread(String myEmailAddress,
ThreadGroup tg) throws ConnectionException
- For simplicity. Default SMTP server port is 25. Command list should be set afterwards.
- Parameters:
- myEmailAddress - Sender email address - username@host
- tg - Thread group
SMTPThread
public SMTPThread(String myEmailAddress,
Vector cmdlist,
ThreadGroup tg) throws ConnectionException
- For simplicity. Default SMTP server port is 25.
- Parameters:
- myEmailAddress - Sender email address - username@host
- cmdlist - Command list
- tg - Thread group
SMTPThread
public SMTPThread(String myEmailAddress,
String receiverMailAddress,
String mail,
ThreadGroup tg) throws ConnectionException
- Constructor, performing the simplest mail transfer. Mail content will be passed as 'mail'
parameter with receiver email address(receiverMailAddress), my user name(username) and
my mail host(mailhost).
- Parameters:
- myEmailAddress - Sender email address - username@host
- receiverMailAddress - Full receiver email address, e.g. jhc@cdr.stanford.edu
- mail - Mail content
- tg - Thread group
SMTPThread
public SMTPThread(Address myAddress,
Address receiverAddress,
String mail,
ThreadGroup tg) throws ConnectionException
- Constructor, performing the simplest mail transfer. Parameters are address object based.
- Parameters:
- myAddress - My address, which should contains my email address in description field
- receiverAddress - Receiver address, which should contains receiver email address
- mail - Mail content
- tg - Thread group
SMTPThread
public SMTPThread(String myEmailAddress,
String receiverMailAddressList[],
String mail,
ThreadGroup tg) throws ConnectionException
- Constructor, performing the simplest mail transfer. Mail content will be passed as 'mail'
parameter with receiver email address(receiverMailAddress), my user name(username) and
my mail host(mailhost).
- Parameters:
- myEmailAddress - Sender email address - username@host
- receiverMailAddressList - Full receiver email addresses - multiple receivers,
- mail - Mail content
- tg - Thread group
makeSimpleCommandList
public void makeSimpleCommandList() throws ConnectionException
- Make command list from given sender, receiver and mail.
Mail header will include extended slot 'X-MessageType' as KQML.
Header will be:
Date: date
Sender: sender
Receiver: ReceiverA ReceiverB ReceiverC
Subject: KQMLMessage
X-MessageType: KQML
- Parameters:
- senderAddr - Sender address
- receiverAddrs - Receiver addresses
- data - Data to be sent, normally a KQML message
getEmailAddress
public String getEmailAddress(Address addr)
- Get email address from Address object
- Parameters:
- addr - Address
- Returns:
- null if no email is specified. Email address(e.g. jhc@cdr.stanford.edu)
if addr contains email address information.
processCommands
public void processCommands()
- processCommands implementation. Send predefined command to mail server and manage received
response.
- Overrides:
- processCommands in class IPThread
processErrorMsg
protected String processErrorMsg(String msg)
- According to the response from mail server, return false if the error message
can not be managed. Return true if the response from server is success or
the error can be fully managed.
Here's standard return codes from email server
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
211 System status, or system help reply
214 Help message
220 Service ready
221 Service closing transmission channel
421 Service not available,
250 Requested mail action okay, completed
251 User not local; will forward to
450 Requested mail action not taken: mailbox unavailable [E.g., mailbox busy]
550 Requested action not taken: mailbox unavailable [E.g., mailbox not found, no access]
451 Requested action aborted: error in processing
551 User not local; please try
452 Requested action not taken: insufficient system storage
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed [E.g., mailbox syntax incorrect]
354 Start mail input; end with .
554 Transaction failed
- Parameters:
- msg - Returned message from email server
notifyError
protected void notifyError(String msg)
- Notify error if _ipAgentAction(class IPRouterClientAction) is not null
- Parameters:
- msg - Message to be notified to _ipAgentAction
notifyMessage
protected void notifyMessage()
- Notify message(FTPCon itself) if _ipAgentAction(class IPRouterClientAction) is not null
_ipAgentAction will invoke processMessage(String,Object) where String is "SMTP" and
Object is _smtpCon.
All Packages Class Hierarchy This Package Previous Next Index