|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Mx
The MX control enables querying of mail exchange (MX) records from a Domain Name Server (DNS). That is, it will find out the name(s) of the mail server(s) accepting email for a given email address or domain.
The control will try to find out automatically the name of a DNS server
from the system's settings and set the DNSServer
property.
The control operates in asynchronous mode: assigning an email
address or domain name to EmailAddress
property directs the control to
query the DNSServer
and fire the Response
event for each server
which handles the mail for the email address and fill out the MailServer
property with the most preferred mail server and the Status
event to
"Ok" or an error message.
RequestId
may be used to identify requests and is used in the Response
event. The user may set its value before sending out requests.
Constructor Summary | |
Mx()
|
Method Summary | |
void |
addMxEventListener(MxEventListener l)
|
void |
fireError(int errorCode,
java.lang.String description)
Information about errors during data delivery. |
void |
fireResponse(int requestId,
java.lang.String domain,
java.lang.String mailServer,
int precedence,
int timeToLive,
int statusCode,
java.lang.String description)
Fired for each MailServer accepting email for the domain. |
int |
getDNSPort()
The port where the DNS server is listening. |
java.lang.String |
getDNSServer()
IP address (or name) of the DNS server to query. |
java.lang.String |
getEmailAddress()
Action property triggering a request to DNSServer . |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
java.lang.String |
getMailServer()
Mail server with lowest precedence value (lowest cost to reach). |
int |
getRequestId()
Identifies each request. |
java.lang.String |
getStatus()
Status of the request: empty while in progress, 'OK' or error message upon completition. |
int |
getTimeout()
A timeout for the component. |
void |
removeMxEventListener(MxEventListener l)
|
void |
resolve(java.lang.String emailAddress)
Resolve an email address. |
void |
setDNSPort(int DNSPort)
The port where the DNS server is listening. |
void |
setDNSServer(java.lang.String DNSServer)
IP address (or name) of the DNS server to query. |
void |
setEmailAddress(java.lang.String emailAddress)
Action property triggering a request to DNSServer . |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setRequestId(int requestId)
Identifies each request. |
void |
setTimeout(int timeout)
A timeout for the component. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Mx()
Method Detail |
public int getDNSPort()
DNSPort
to any other value
for use with experimental servers, etc.
public void setDNSPort(int DNSPort) throws IPWorksException
DNSPort
to any other value
for use with experimental servers, etc.
public java.lang.String getDNSServer()
DNSServer
property. You may later
change it to any particular DNS server you want to query.
If the control cannot determine the default DNS server address, the property value will be an empty string.
public void setDNSServer(java.lang.String DNSServer) throws IPWorksException
DNSServer
property. You may later
change it to any particular DNS server you want to query.
If the control cannot determine the default DNS server address, the property value will be an empty string.
public java.lang.String getEmailAddress()
EmailAddress
directs the control to query DNSServer
at port DNSPort
about MX records
related to EmailAddress
.
The server's response is provided through one or more Response
events.
After the query completes, the MailServer
property is set to
the best mail server and
the Status
property has the result description of the
response.
Valid queries are email addresses like name@company.com or hostnames and domains like domain.com .
public void setEmailAddress(java.lang.String emailAddress) throws IPWorksException
EmailAddress
directs the control to query DNSServer
at port DNSPort
about MX records
related to EmailAddress
.
The server's response is provided through one or more Response
events.
After the query completes, the MailServer
property is set to
the best mail server and
the Status
property has the result description of the
response.
Valid queries are email addresses like name@company.com or hostnames and domains like domain.com .
public java.lang.String getLocalHost()
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost) throws IPWorksException
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public java.lang.String getMailServer()
MailServer
property holds
the name of the best mail server for the EmailAddress
and
the Status
property holds the completition status.
public int getRequestId()
EmailAddress
property).
If a custom value is needed for RequestId
, the property must be set
before setting EmailAddress
. The control increments RequestId
automatically after sending each request.
public void setRequestId(int requestId) throws IPWorksException
EmailAddress
property).
If a custom value is needed for RequestId
, the property must be set
before setting EmailAddress
. The control increments RequestId
automatically after sending each request.
public java.lang.String getStatus()
Status
property is reset each time a request is made by setting EmailAddress
. When a response comes from the DNSServer
the Status
property is set to "OK" in case of success or to an error message as described
in the Response
event.
public int getTimeout()
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public void setTimeout(int timeout) throws IPWorksException
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public void fireError(int errorCode, java.lang.String description)
MxErrorEvent
public void fireResponse(int requestId, java.lang.String domain, java.lang.String mailServer, int precedence, int timeToLive, int statusCode, java.lang.String description)
MxResponseEvent
public void resolve(java.lang.String emailAddress) throws IPWorksException
EmailAddress
property
to EmailAddress .
public void addMxEventListener(MxEventListener l) throws java.util.TooManyListenersException
public void removeMxEventListener(MxEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |