|
IP*Works! SSL V9 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectipworksssl.Smtps
public class Smtps
The SMTPS Bean is used to send Internet mail using the SMTP protocol (the Internet mail standard).
The SMTPS Bean is the SSL-enabled equivalent (RFC 2487) of the IP*Works! SMTP bean. The main difference is the introduction of a set of new configuration settings, properties and events that deal with SSL security. The ipworksssl.Smtps#config and {@link ipworksssl.Smtps#config configuration settings determine which protocols are enabled and at what security level. The {@link ipworksssl.Smtps#getSSLCert SSLCert} property is used to select a client certificate if the server is requesting client authentication. The {@link ipworksssl.Smtps#config configuration setting, together with the {@link ipworksssl.SmtpsSSLServerAuthenticationEvent SSLServerAuthentication} event allow you to check the server identity and other security attributes. Finally, the {@link ipworksssl.SmtpsSSLStatusEvent SSLStatus} event provides information about the SSL handshake.
The SMTPS Bean implements a standard SMTP client as specified in RFC 821. It has a simple plug-and-play interface. It contains a number of properties like {@link ipworksssl.Smtps#getSendTo SendTo} , {@link ipworksssl.Smtps#getSubject Subject} , {@link ipworksssl.Smtps#getFrom From} , {@link ipworksssl.Smtps#getCc Cc} , {@link ipworksssl.Smtps#getBCc BCc} , etc. that map directly to the internet mail message headers with the same name (RFC 822). The message text is set in {@link ipworksssl.Smtps#getMessageText MessageText} . Messages are sent by calling the {@link ipworksssl.Smtps#send Send} method.
The bean supports message delivery to multiple recipients through the {@link ipworksssl.Smtps#getSendTo SendTo} , {@link ipworksssl.Smtps#getCc Cc} , and {@link ipworksssl.Smtps#getBCc BCc} properties. Simply specify the destination email addresses separated by commas.
The interface of the bean is open-ended. New features, including MIME attachments can be supported by using the {@link ipworksssl.Smtps#getOtherHeaders OtherHeaders} property.
A number of events provide feedback during the operation of the bean. The {@link ipworksssl.SmtpsTransferEvent Transfer} event is fired during message delivery to show the number of bytes delivered. The {@link ipworksssl.SmtpsPITrailEvent PITrail} event traces the commands that are sent to the server and the respective replies.
| Field Summary | |
|---|---|
static int |
amCRAMMD5
|
static int |
amKerberos
|
static int |
amNTLM
|
static int |
amSASLPlain
|
static int |
amUserPassword
|
static int |
amXOAUTH2
|
static int |
epNonUrgent
|
static int |
epNormal
|
static int |
epUnspecified
|
static int |
epUrgent
|
static int |
esCompanyConfidential
|
static int |
esPersonal
|
static int |
esPrivate
|
static int |
esUnspecified
|
static int |
miHigh
|
static int |
miLow
|
static int |
miNormal
|
static int |
miUnspecified
|
static int |
sslAutomatic
|
static int |
sslExplicit
|
static int |
sslImplicit
|
static int |
sslNone
|
| Constructor Summary | |
|---|---|
Smtps()
Creates an instance of Smtps Bean. |
|
Smtps(java.lang.String runtimeLicense)
Creates an instance of Smtps Bean with specified run-time license. |
|
| Method Summary | |
|---|---|
void |
addSmtpsEventListener(SmtpsEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a {@link ipworksssl.Smtps#config configuration setting. |
void |
connect()
Connects to the mail relay and sends the SMTP HELO command. |
void |
disconnect()
Disconnects from the SMTP server. |
void |
doEvents()
Processes events from the internal message queue. |
void |
expand(java.lang.String emailAddress)
Asks the MailServer to expand a name or mailing list. |
int |
getAuthMechanism()
Used when connecting to the mail server. |
java.lang.String |
getBCc()
A comma separated list of addresses for blind carbon copies (optional). |
java.lang.String |
getCc()
A comma separated list of addresses for carbon copies (optional). |
java.lang.String |
getDeliveryNotificationTo()
Email address to send to which to send a delivery notification. |
Firewall |
getFirewall()
A set of properties related to firewall access. |
java.lang.String |
getFrom()
The email address of the sender (required). |
int |
getImportance()
Importance of the mail message (optional). |
java.lang.String |
getLastReply()
The last reply from the server. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
int |
getMailPort()
The server port for SMTP (default 25). |
java.lang.String |
getMailServer()
The name or address of a mail server (mail relay). |
byte[] |
getMessage()
Provides a way to set the raw message content. |
java.lang.String |
getMessageDate()
Date of the mail message (optional). |
HeaderList |
getMessageHeaders()
Collection of RFC822-encoded headers of the message. |
java.lang.String |
getMessageHeadersString()
String representation of RFC822-encoded headers of the message. |
java.lang.String |
getMessageId()
The Message Identifier for the message. |
MessageRecipientList |
getMessageRecipients()
The collection of recipients of the message. |
java.lang.String |
getMessageText()
The full text of the message to send (without headers). |
java.lang.String |
getOtherHeaders()
An RFC 822 compliant string consisting of extra headers. |
java.lang.String |
getPassword()
A password for logon to the MailServer . |
int |
getPriority()
Priority of the mail message (optional). |
java.lang.String |
getReadReceiptTo()
Email address to send a read receipt to. |
java.lang.String |
getReplyTo()
A mail address to which to reply (optional). |
java.lang.String |
getReturnPath()
Sets the Return-Path to be used for sending email. |
java.lang.String |
getSendTo()
A comma separated list of addresses for destinations (required). |
int |
getSensitivity()
Sensitivity of the mail message (optional). |
Certificate |
getSSLAcceptServerCert()
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate. |
Certificate |
getSSLCert()
The certificate to be used during SSL negotiation. |
Certificate |
getSSLServerCert()
The server certificate for the last established connection. |
int |
getSSLStartMode()
Determines how the bean starts the SSL negotiation. |
java.lang.String |
getSubject()
The subject of the mail message (optional). |
int |
getTimeout()
A timeout for the bean. |
java.lang.String |
getUser()
A user identifier to login as in the MailServer . |
void |
interrupt()
Interrupt the current method. |
boolean |
isAllowExtensions()
A switch allowing the bean to use ESMTP features (SMTP extensions). |
boolean |
isConnected()
Shows whether the bean is connected. |
boolean |
isIdle()
The current status of the component. |
void |
processQueue(java.lang.String queueDir)
Sends the messages which have previously been queued into QueueDir . |
java.lang.String |
queue(java.lang.String queueDir)
Queues the message into QueueDir . |
void |
removeSmtpsEventListener(SmtpsEventListener l)
|
void |
resetHeaders()
Resets all the message headers to empty. |
void |
send()
Sends the current message. |
void |
sendToTerminalAndEmail()
Sends to terminal and email. |
void |
sendToTerminalOnly()
Sends to terminal only. |
void |
sendToTerminalOrEmail()
Sends to terminal or email. |
void |
setAllowExtensions(boolean allowExtensions)
A switch allowing the bean to use ESMTP features (SMTP extensions). |
void |
setAuthMechanism(int authMechanism)
Used when connecting to the mail server. |
void |
setBCc(java.lang.String BCc)
A comma separated list of addresses for blind carbon copies (optional). |
void |
setCc(java.lang.String cc)
A comma separated list of addresses for carbon copies (optional). |
void |
setCommand(java.lang.String command)
Used to send additional commands directly to the server. |
void |
setConnected(boolean connected)
Shows whether the bean is connected. |
void |
setDeliveryNotificationTo(java.lang.String deliveryNotificationTo)
Email address to send to which to send a delivery notification. |
void |
setFirewall(Firewall firewall)
A set of properties related to firewall access. |
void |
setFrom(java.lang.String from)
The email address of the sender (required). |
void |
setImportance(int importance)
Importance of the mail message (optional). |
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 |
setMailPort(int mailPort)
The server port for SMTP (default 25). |
void |
setMailServer(java.lang.String mailServer)
The name or address of a mail server (mail relay). |
void |
setMessage(byte[] message)
Provides a way to set the raw message content. |
void |
setMessageDate(java.lang.String messageDate)
Date of the mail message (optional). |
void |
setMessageId(java.lang.String messageId)
The Message Identifier for the message. |
void |
setMessageStream(java.io.InputStream messageStream)
Sets the stream to be uploaded to the server as part of the message. |
void |
setMessageText(java.lang.String messageText)
The full text of the message to send (without headers). |
void |
setOtherHeaders(java.lang.String otherHeaders)
An RFC 822 compliant string consisting of extra headers. |
void |
setPassword(java.lang.String password)
A password for logon to the MailServer . |
void |
setPriority(int priority)
Priority of the mail message (optional). |
void |
setReadReceiptTo(java.lang.String readReceiptTo)
Email address to send a read receipt to. |
void |
setReplyTo(java.lang.String replyTo)
A mail address to which to reply (optional). |
void |
setReturnPath(java.lang.String returnPath)
Sets the Return-Path to be used for sending email. |
void |
setSendTo(java.lang.String sendTo)
A comma separated list of addresses for destinations (required). |
void |
setSensitivity(int sensitivity)
Sensitivity of the mail message (optional). |
void |
setSSLAcceptServerCert(Certificate SSLAcceptServerCert)
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate. |
void |
setSSLCert(Certificate SSLCert)
The certificate to be used during SSL negotiation. |
void |
setSSLStartMode(int SSLStartMode)
Determines how the bean starts the SSL negotiation. |
void |
setSubject(java.lang.String subject)
The subject of the mail message (optional). |
void |
setTimeout(int timeout)
A timeout for the bean. |
void |
setUser(java.lang.String user)
A user identifier to login as in the MailServer . |
void |
verify(java.lang.String emailAddress)
Sends a Verification request to the SMTP server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int amUserPassword
public static final int amCRAMMD5
public static final int amNTLM
public static final int amSASLPlain
public static final int amKerberos
public static final int amXOAUTH2
public static final int miUnspecified
public static final int miHigh
public static final int miNormal
public static final int miLow
public static final int epUnspecified
public static final int epNormal
public static final int epUrgent
public static final int epNonUrgent
public static final int esUnspecified
public static final int esPersonal
public static final int esPrivate
public static final int esCompanyConfidential
public static final int sslAutomatic
public static final int sslImplicit
public static final int sslExplicit
public static final int sslNone
| Constructor Detail |
|---|
public Smtps()
public Smtps(java.lang.String runtimeLicense)
| Method Detail |
|---|
public boolean isAllowExtensions()
This property is a switch allowing the bean to use ESMTP features (SMTP extensions). If this property is true, the bean will first send the EHLO greeting to the server and, if that fails, the standard HELO command will be sent.
This property is true by default but may be disabled
if it's known in advance that the MailServer doesn't
support SMTP extensions.
public void setAllowExtensions(boolean allowExtensions)
throws IPWorksSSLException
This property is a switch allowing the bean to use ESMTP features (SMTP extensions). If this property is true, the bean will first send the EHLO greeting to the server and, if that fails, the standard HELO command will be sent.
This property is true by default but may be disabled
if it's known in advance that the MailServer doesn't
support SMTP extensions.
IPWorksSSLExceptionpublic int getAuthMechanism()
The authentication mechanism property to be used when connecting to the mail server.
By default, this property is amUserPassword (0), and if the User and Password properties are set, the AUTH command is sent to the
server for authentication. If this property is set to amCRAMMD5 (1), CRAM-MD5
authentication is used instead.
If this property is set to amNTLM (2) NTLM authentication will be used.
If this property is set to amKerberos (6) Kerberos authentication will be used. NOTE: This functionality is only available in Windows.
public void setAuthMechanism(int authMechanism)
throws IPWorksSSLException
The authentication mechanism property to be used when connecting to the mail server.
By default, this property is amUserPassword (0), and if the User and Password properties are set, the AUTH command is sent to the
server for authentication. If this property is set to amCRAMMD5 (1), CRAM-MD5
authentication is used instead.
If this property is set to amNTLM (2) NTLM authentication will be used.
If this property is set to amKerberos (6) Kerberos authentication will be used. NOTE: This functionality is only available in Windows.
IPWorksSSLExceptionpublic java.lang.String getBCc()
This property specifies a comma separated list of destinations for blind carbon copies of the mail message. A copy of the message is sent to each destination, but no BCc SMTP header is created containing the destination addresses, so individual recipients never see the list of the other recipients.
The bean will return an error if the MailServer returns an error code
about any email address specified in SendTo or Cc but it will only fire an Error event if the same happens
with an email address specified in this property.
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
public void setBCc(java.lang.String BCc)
throws IPWorksSSLException
This property specifies a comma separated list of destinations for blind carbon copies of the mail message. A copy of the message is sent to each destination, but no BCc SMTP header is created containing the destination addresses, so individual recipients never see the list of the other recipients.
The bean will return an error if the MailServer returns an error code
about any email address specified in SendTo or Cc but it will only fire an Error event if the same happens
with an email address specified in this property.
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
IPWorksSSLExceptionpublic java.lang.String getCc()
This property specifies a comma separated list of destinations
for carbon copies of the mail message. A copy of the message
is sent to each destination, and a Cc SMTP header is created
containing the destination addresses. This header is sent to every
recipient of the message. If you don't want to copy this information
to every recipient, then use blind carbon copies instead (see the
description of the BCc ).
The bean will return an error if the MailServer returns an error code
about any email address specified in SendTo or Cc but it will only fire an Error event
if the same happens
with an email address specified in BCc .
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
public void setCc(java.lang.String cc)
throws IPWorksSSLException
This property specifies a comma separated list of destinations
for carbon copies of the mail message. A copy of the message
is sent to each destination, and a Cc SMTP header is created
containing the destination addresses. This header is sent to every
recipient of the message. If you don't want to copy this information
to every recipient, then use blind carbon copies instead (see the
description of the BCc ).
The bean will return an error if the MailServer returns an error code
about any email address specified in SendTo or Cc but it will only fire an Error event
if the same happens
with an email address specified in BCc .
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
IPWorksSSLException
public void setCommand(java.lang.String command)
throws IPWorksSSLException
This property can be used to send additional commands directly to the server. Check the LastReply property and/or trap the PITrail events
coming from the server to get the response.
IPWorksSSLExceptionpublic boolean isConnected()
This property is used to determine whether or not the bean is connected to the remote host.
public void setConnected(boolean connected)
throws IPWorksSSLException
This property is used to determine whether or not the bean is connected to the remote host.
IPWorksSSLExceptionpublic java.lang.String getDeliveryNotificationTo()
This property contains the email address to send to which to send a delivery notification. When set, a Return-Receipt-To header is added to the message. This property should be set to an email address which should receive the delivery notification.
public void setDeliveryNotificationTo(java.lang.String deliveryNotificationTo)
throws IPWorksSSLException
This property contains the email address to send to which to send a delivery notification. When set, a Return-Receipt-To header is added to the message. This property should be set to an email address which should receive the delivery notification.
IPWorksSSLExceptionpublic Firewall getFirewall()
This is a Firewall type property which
contains fields describing the firewall
through which the bean will attempt to connect.
public void setFirewall(Firewall firewall)
throws IPWorksSSLException
This is a Firewall type property which
contains fields describing the firewall
through which the bean will attempt to connect.
IPWorksSSLExceptionpublic java.lang.String getFrom()
This property is used to create a From SMTP header. This header identifies the sender of the message. A valid email address is required. Examples of valid addresses are: "Friendly Name" <address@company.com> or address@company.com
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
public void setFrom(java.lang.String from)
throws IPWorksSSLException
This property is used to create a From SMTP header. This header identifies the sender of the message. A valid email address is required. Examples of valid addresses are: "Friendly Name" <address@company.com> or address@company.com
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
IPWorksSSLExceptionpublic boolean isIdle()
Idle will be False if the component is currently busy (communicating
and/or waiting for an answer), and True at all other times.
public int getImportance()
This property indicates the importance of the mail message (optional). When set, an Importance header will added to the message.
Importance is an indication to the recipient(s) about how important the message is. The possible values are High (1), Normal (2), and Low (3).
public void setImportance(int importance)
throws IPWorksSSLException
This property indicates the importance of the mail message (optional). When set, an Importance header will added to the message.
Importance is an indication to the recipient(s) about how important the message is. The possible values are High (1), Normal (2), and Low (3).
IPWorksSSLExceptionpublic java.lang.String getLastReply()
This property indicates the last reply received from the server. It
can be used for informational purposes. The same information
and more can also be retrieved through the PITrail event.
public java.lang.String getLocalHost()
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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 multi-homed
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 IPWorksSSLException
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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 multi-homed
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.
IPWorksSSLExceptionpublic int getMailPort()
This property contains the server port for SMTP (default 25). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
For implicit SSL, use port 465 (please refer to the SSLStartMode property
for more information).
public void setMailPort(int mailPort)
throws IPWorksSSLException
This property contains the server port for SMTP (default 25). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
For implicit SSL, use port 465 (please refer to the SSLStartMode property
for more information).
IPWorksSSLExceptionpublic java.lang.String getMailServer()
This property specifies the IP address (IP number in dotted internet format) or Domain Name for a mail relay through which messages will be routed. It is set before a connection is attempted and cannot be changed once a connection is in progress.
The current version of the bean does not provide a default
value for the mail relay. You must provide a host name yourself.
Generally, any internet host with an SMTP server will suffice
(a UNIX host for example), but it is preferable to select a MailServer that is close to the machine sending mail.
If this property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful, an error is returned.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
public void setMailServer(java.lang.String mailServer)
throws IPWorksSSLException
This property specifies the IP address (IP number in dotted internet format) or Domain Name for a mail relay through which messages will be routed. It is set before a connection is attempted and cannot be changed once a connection is in progress.
The current version of the bean does not provide a default
value for the mail relay. You must provide a host name yourself.
Generally, any internet host with an SMTP server will suffice
(a UNIX host for example), but it is preferable to select a MailServer that is close to the machine sending mail.
If this property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful, an error is returned.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
IPWorksSSLExceptionpublic byte[] getMessage()
This property may be set instead of MessageText . The value set here will not be modified in any way
by the bean and will be sent as is. Use caution when setting this value as all encoding must be done
before supplying the value to the component.
public void setMessage(byte[] message)
throws IPWorksSSLException
This property may be set instead of MessageText . The value set here will not be modified in any way
by the bean and will be sent as is. Use caution when setting this value as all encoding must be done
before supplying the value to the component.
IPWorksSSLExceptionpublic java.lang.String getMessageDate()
If this property contains a non-empty string, then a Date SMTP header is created and attached to the message. If it is an empty string, then the date information is added by the mail relay(s) the message goes through.
Special case: if this property is set to the special value "*", a Date SMTP header reflecting the current date and time is generated when MessageHeaders is computed and the message is sent. This is the default behavior of the bean
RFC 822 contains detailed date format specifications. An example of a valid date is "Fri, 1 Mar 96 21:24:52 EST".
public void setMessageDate(java.lang.String messageDate)
throws IPWorksSSLException
If this property contains a non-empty string, then a Date SMTP header is created and attached to the message. If it is an empty string, then the date information is added by the mail relay(s) the message goes through.
Special case: if this property is set to the special value "*", a Date SMTP header reflecting the current date and time is generated when MessageHeaders is computed and the message is sent. This is the default behavior of the bean
RFC 822 contains detailed date format specifications. An example of a valid date is "Fri, 1 Mar 96 21:24:52 EST".
IPWorksSSLExceptionpublic HeaderList getMessageHeaders()
This property holds the full headers of the message in RFC822 format.
public java.lang.String getMessageHeadersString()
This property holds the full headers of the message in RFC822 format.
public java.lang.String getMessageId()
This property contains the Message Identifier for the message. When set, the value of MessageId is used as the Message-ID header value of the message. A special value of "*" will automatically generate a random unique identifier for the message.
public void setMessageId(java.lang.String messageId)
throws IPWorksSSLException
This property contains the Message Identifier for the message. When set, the value of MessageId is used as the Message-ID header value of the message. A special value of "*" will automatically generate a random unique identifier for the message.
IPWorksSSLExceptionpublic MessageRecipientList getMessageRecipients()
This property contains a collection which describes to whom the message is being sent. You may include all recipients in this property, even Cc's and BCc's, which are specified by the type field.
This collection is indexed from 0 to size - 1.
public java.lang.String getMessageText()
This property contains the full text of the message.
It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\r\ n") . The text in the message lines must contain 7-bit characters so that the message can be successfully pass through the multitude of mail systems on the Internet.
The bean automatically escapes lines that start with a "." by adding another as specified in RFC 821. The message text is unescaped by the receiving agent, so the process is fully transparent.
public void setMessageText(java.lang.String messageText)
throws IPWorksSSLException
This property contains the full text of the message.
It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\r\ n") . The text in the message lines must contain 7-bit characters so that the message can be successfully pass through the multitude of mail systems on the Internet.
The bean automatically escapes lines that start with a "." by adding another as specified in RFC 821. The message text is unescaped by the receiving agent, so the process is fully transparent.
IPWorksSSLExceptionpublic java.lang.String getOtherHeaders()
This property contains a string of headers
to be appended to the message headers created from other
properties like SendTo , Subject , etc.
The headers must of the format "header: value" as specified in RFC 822. Header lines should be separated by CRLF ("\r\ n") .
Use this property with caution. If this property contains invalid headers, message delivery might not be successful.
This property is useful for extending the functionality of the bean. A good example is delivery of MIME encoded messages.
SPECIAL CASE: if this property starts with an empty line (CRLF), then the value of this property is used instead of the normally computed message headers.
Example (Send an Email With Additional Header)
control.MailServer = "MyServer"
control.From = "me@server.com"
control.SendTo = "recipient@server.com"
control.Subject = "My Subject"
control.MessageText = "This is the message body"
control.OtherHeaders = "HeaderName: Headervalue"
control.Send()
public void setOtherHeaders(java.lang.String otherHeaders)
throws IPWorksSSLException
This property contains a string of headers
to be appended to the message headers created from other
properties like SendTo , Subject , etc.
The headers must of the format "header: value" as specified in RFC 822. Header lines should be separated by CRLF ("\r\ n") .
Use this property with caution. If this property contains invalid headers, message delivery might not be successful.
This property is useful for extending the functionality of the bean. A good example is delivery of MIME encoded messages.
SPECIAL CASE: if this property starts with an empty line (CRLF), then the value of this property is used instead of the normally computed message headers.
Example (Send an Email With Additional Header)
control.MailServer = "MyServer"
control.From = "me@server.com"
control.SendTo = "recipient@server.com"
control.Subject = "My Subject"
control.MessageText = "This is the message body"
control.OtherHeaders = "HeaderName: Headervalue"
control.Send()
IPWorksSSLExceptionpublic java.lang.String getPassword()
MailServer .
If this property is set to a non-empty string,
then when connecting to the MailServer an AUTH or CRAM-MD5 (depending on the value of AuthMechanism )
command is sent in order to provide authentication
information for the user.
public void setPassword(java.lang.String password)
throws IPWorksSSLException
MailServer .
If this property is set to a non-empty string,
then when connecting to the MailServer an AUTH or CRAM-MD5 (depending on the value of AuthMechanism )
command is sent in order to provide authentication
information for the user.
IPWorksSSLExceptionpublic int getPriority()
When this property is set, a Priority header will be added to the message. Priority is an indication about the delivery priority of the message. The possible values are epNormal, epUrgent, and epNonUrgent.
public void setPriority(int priority)
throws IPWorksSSLException
When this property is set, a Priority header will be added to the message. Priority is an indication about the delivery priority of the message. The possible values are epNormal, epUrgent, and epNonUrgent.
IPWorksSSLExceptionpublic java.lang.String getReadReceiptTo()
When this property is set, a Disposition-Notification-To header is added to the message. This property should be set to an email address which should receive the read-receipt.
public void setReadReceiptTo(java.lang.String readReceiptTo)
throws IPWorksSSLException
When this property is set, a Disposition-Notification-To header is added to the message. This property should be set to an email address which should receive the read-receipt.
IPWorksSSLExceptionpublic java.lang.String getReplyTo()
If this property contains a non-empty string,
a Reply-To SMTP header is created for the message.
This header shows the address to use for replies (useful
if this address is different from the one in From ).
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
public void setReplyTo(java.lang.String replyTo)
throws IPWorksSSLException
If this property contains a non-empty string,
a Reply-To SMTP header is created for the message.
This header shows the address to use for replies (useful
if this address is different from the one in From ).
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
IPWorksSSLExceptionpublic java.lang.String getReturnPath()
Setting this property sets the Return-Path to be used for sending email.
If this is not set, the value in the From property is used.
public void setReturnPath(java.lang.String returnPath)
throws IPWorksSSLException
Setting this property sets the Return-Path to be used for sending email.
If this is not set, the value in the From property is used.
IPWorksSSLExceptionpublic java.lang.String getSendTo()
This property specifies a comma separated list of destinations for the mail message. A copy of the message is sent to each of them, and a To SMTP header is created containing the destination addresses.
Examples of valid addresses are: "Friendly Name" <address@company.com> or address@company.com
The bean will fail if the MailServer returns an error code
about any email address specified in SendTo or Cc but it
will silently ignore the error if the same happens
with an email address specified in BCc .
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
public void setSendTo(java.lang.String sendTo)
throws IPWorksSSLException
This property specifies a comma separated list of destinations for the mail message. A copy of the message is sent to each of them, and a To SMTP header is created containing the destination addresses.
Examples of valid addresses are: "Friendly Name" <address@company.com> or address@company.com
The bean will fail if the MailServer returns an error code
about any email address specified in SendTo or Cc but it
will silently ignore the error if the same happens
with an email address specified in BCc .
If the resulting header is longer than ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
NOTE: You must clear the {@link ipworksssl.Smtps#getMessageRecipients MessageRecipients} collection before setting this property to remove previous recipients.
IPWorksSSLExceptionpublic int getSensitivity()
This property is an indication of how sensitive it is to disclose the message to people other than the recipients of the message. When set, a Sensitivity header will added to the message. Possible values are: esPersonal (1), esPrivate (2), and esCompanyConfidential (3).
public void setSensitivity(int sensitivity)
throws IPWorksSSLException
This property is an indication of how sensitive it is to disclose the message to people other than the recipients of the message. When set, a Sensitivity header will added to the message. Possible values are: esPersonal (1), esPrivate (2), and esCompanyConfidential (3).
IPWorksSSLExceptionpublic Certificate getSSLAcceptServerCert()
If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.
You may override this behavior by supplying a value for SSLAcceptServerCert .
If the certificate supplied in SSLAcceptServerCert is the same as the
certificate presented by the server, then the server
certificate is accepted unconditionally, and the connection will continue
normally.
Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, this property may create a security breach. Use it at your own risk.
public void setSSLAcceptServerCert(Certificate SSLAcceptServerCert)
throws IPWorksSSLException
If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.
You may override this behavior by supplying a value for SSLAcceptServerCert .
If the certificate supplied in SSLAcceptServerCert is the same as the
certificate presented by the server, then the server
certificate is accepted unconditionally, and the connection will continue
normally.
Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, this property may create a security breach. Use it at your own risk.
IPWorksSSLExceptionpublic Certificate getSSLCert()
The digital certificate that the bean will use
during SSL negotiation. Set this property to a valid
certificate before starting SSL negotiation. To set
a certificate, you may set the Encoded field to
the encoded certificate. To select a certificate, use
the store and subject fields.
public void setSSLCert(Certificate SSLCert)
throws IPWorksSSLException
The digital certificate that the bean will use
during SSL negotiation. Set this property to a valid
certificate before starting SSL negotiation. To set
a certificate, you may set the Encoded field to
the encoded certificate. To select a certificate, use
the store and subject fields.
IPWorksSSLExceptionpublic Certificate getSSLServerCert()
SSLServerCert contains the server certificate for the
last established connection.
SSLServerCert is reset every time a new connection is attempted.
public int getSSLStartMode()
The SSLStartMode property may have one of the following values:
SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit
( sslImplicit ).
public void setSSLStartMode(int SSLStartMode)
throws IPWorksSSLException
The SSLStartMode property may have one of the following values:
SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit
( sslImplicit ).
IPWorksSSLExceptionpublic java.lang.String getSubject()
The string in this property is sent with a Subject SMTP header to the mail recipient.
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
public void setSubject(java.lang.String subject)
throws IPWorksSSLException
The string in this property is sent with a Subject SMTP header to the mail recipient.
If the resulting header is longer than {@link ipworksssl.Smtps#config , then it is folded according to RFC 822 specifications.
IPWorksSSLExceptionpublic int getTimeout()
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean 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 remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an exception.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
any amount of data is successfully sent or received.
Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by the ipworksssl.Smtps#config configuration setting.
The default value for the {@link ipworksssl.Smtps#getTimeout Timeout} property is 60 (seconds).
public void setTimeout(int timeout)
throws IPWorksSSLException
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean 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 remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an exception.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
any amount of data is successfully sent or received.
Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by the ipworksssl.Smtps#config configuration setting.
The default value for the {@link ipworksssl.Smtps#getTimeout Timeout} property is 60 (seconds).
IPWorksSSLExceptionpublic java.lang.String getUser()
MailServer .
If this property is set to a non-empty string,
then when connecting to the MailServer an AUTH or CRAM-MD5 (depending on the value of AuthMechanism )
command is sent in order to provide authentication
information for the user.
public void setUser(java.lang.String user)
throws IPWorksSSLException
MailServer .
If this property is set to a non-empty string,
then when connecting to the MailServer an AUTH or CRAM-MD5 (depending on the value of AuthMechanism )
command is sent in order to provide authentication
information for the user.
IPWorksSSLException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksSSLException
{@link ipworksssl.Smtps#config Config} is a generic method available in every bean. It is used to set and retrieve {@link ipworksssl.Smtps#config configuration settingsfor the bean.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the {@link ipworksssl.Smtps#config Config} method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a {@link ipworksssl.Smtps#config configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
The bean accepts one or more of the following configuration settings . Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the {@link ipworksssl.Smtps#config Config} method.
Bearer ya29.AHES6ZRmS-8xPbpGetC1VbABJIBRdKm-c4X7wMVGAbgxdGt5q8Ts3Q Note: When using amXOAUTH2 {@link ipworksssl.Smtps#getUser User} must be specified, but {@link ipworksssl.Smtps#getPassword Password} is not required.
NOTE: This is the same as Host . This setting is provided for use by beans that do not directly expose Firewall properties.
{@link ipworksssl.Smtps#getRemotePort RemotePort} is the port in which the firewall will listen to. If set to 0, the firewall will select a random port. The binding (address and port) is provided through the {@link ipworksssl.SmtpsConnectionStatusEvent ConnectionStatus} event.
The connection to the firewall is made by calling the {@link ipworksssl.Smtps#connect Connect} method.
In the second scenario, {@link ipworksssl.Smtps#config is a positive value, the system will attempt to send pending data until the specified {@link ipworksssl.Smtps#config is reached. If this attempt fails, then the system will reset the connection.
The default behavior (which is also the default mode for stream sockets) might result in a long delay in closing the connection. Although the bean returns control immediately, the system could hold system resources until all pending data is sent (even after your application closes).
Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you sent (by a client acknowledgment, for example), setting this property to False might be the appropriate course of action.
If the bean is connected, the {@link ipworksssl.Smtps#getLocalHost LocalHost} setting 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 multi-homed hosts (machines with more than one IP interface).
{@link ipworksssl.Smtps#getLocalPort LocalPort} cannot be changed once a connection is made. Any attempt to set this when a connection is active will generate an error.
This; setting is useful when trying to connect to services that require a trusted port in the client side. An example is the remote shell (rsh) service in UNIX systems.
If no {@link ipworksssl.Smtps#getEOL EOL} is found, and {@link ipworksssl.Smtps#config bytes are accumulated in the buffer, the {@link ipworksssl.SmtpsDataInEvent DataIn} event is fired with the EOL parameter set to False, and the buffer is reset.
The minimum value for {@link ipworksssl.Smtps#config is 256 bytes. The default value is 2048 bytes. The maximum value is 65536 bytes.
Use this setting with caution. Requesting a lower cipher strength than necessary could potentially cause serious security vulnerabilities in your application.
When the provider is OpenSSL, SSLCipherStrength is currently not supported. This functionality is instead made available through the {@link ipworksssl.Smtps#config config setting.
When the provider is OpenSSL, SSLCipherStrength is currently not supported. This functionality is instead made available through the {@link ipworksssl.Smtps#config config setting.
TLS 1.1 and TLS1.2 support are only available starting with Windows 7.
The special value "*" (default) picks the default SSL provider defined in the system.
Note: On Windows systems, the default SSL Provider is "Microsoft Unified Security Protocol Provider" and cannot be changed.
The special value "*" means that the component will pick all of the supported cipher suites. If SSLEnabledCipherSuites is set to any other value, only the specified cipher suites will be considered.
Multiple cipher suites are separated by semicolons.
Example values:
obj.config("SSLEnabledCipherSuites=*");
obj.config("SSLEnabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA");
obj.config("SSLEnabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA; SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA"); Possible values include:
SSLEnabledCipherSuites is used together with SSLCipherStrength .
Note: This configuration setting is available only in .NET and Java.
obj.Config("SSLEnabledProtocols=3072"); // TLS1.2 (supports SHA_256)
obj.Config("SSLAlgorithmList=CALG_SHA_256;CALG_MD5"); Possible values include:
This option is only valid in Windows.
IPWorksSSLException
public void connect()
throws IPWorksSSLException
This method connects to the mail relay and sends the SMTP HELO command, thus
preparing for sending messages. Any number of messages can later be sent
using the Send method.
Example (Connect and Send an Email)
control.MailServer = "MyServer"
control.From = "me@server.com"
control.SendTo = "recipient@server.com"
control.Subject = "My Subject"
control.MessageText = "This is the message body"
control.Connect()
control.Send()
control.Disconnect()
IPWorksSSLException
public void disconnect()
throws IPWorksSSLException
This method disconnects from the mail relay.
IPWorksSSLException
public void doEvents()
throws IPWorksSSLException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksSSLException
public void expand(java.lang.String emailAddress)
throws IPWorksSSLException
MailServer to expand a name or mailing list.
This method asks the MailServer to expand a name or mailing list. The resulting response is provided in
one or more Expand events (one for each address).
The bean will try to connect to the mail relay if it is not already connected.
IPWorksSSLException
public void interrupt()
throws IPWorksSSLException
If there is no method in progress, Interrupt simply returns, doing nothing.
IPWorksSSLException
public void processQueue(java.lang.String queueDir)
throws IPWorksSSLException
This method sends the messages which have previously been queued into QueueDir . The PITrail event shows the interaction with the server as
messages as are processed.
This method looks in the directory for files with extension ".queued" and starts processing them.
When processing starts, the file extension is changed to ".sending". If an error happens at this stage, the sending process is aborted, and the file extension is changed to ".failed".
If the file is successfully sent, the file is normally deleted, unless the {@link ipworksssl.Smtps#config configuration setting is set to True, in which case the file extension is instead changed to ".sent" and the queue file is not deleted.
IPWorksSSLException
public java.lang.String queue(java.lang.String queueDir)
throws IPWorksSSLException
This method queues the message into QueueDir . The message is queued into a unique file into the directory QueueDir for future processing.
QueueDir must already exist, or an error will be generated.
The method returns the name of the unique queue file created in QueueDir . The file extension is ".queued".
Please refer to the ProcessQueue method for more information on email queue
processing.
IPWorksSSLException
public void resetHeaders()
throws IPWorksSSLException
This method resets all the message headers to "" (empty string). Use this method before creating a new message, so that headers from the previous message are not carried over to the next one.
IPWorksSSLException
public void send()
throws IPWorksSSLException
This method sends the current message. If the bean is not connected to the mail relay, a connection is created, the message is sent, and then the connection is closed unless an error occurs.
If the bean is already connected (by use of the Connect method), the
connection will remain open after the message is sent. To disconnect, call the Disconnect method.
Example (Send an Email)
SMTPControl.MailServer = "MyServer"
SMTPControl.From = "me@server.com"
SMTPControl.SendTo = "recipient@server.com"
SMTPControl.Subject = "My Subject"
SMTPControl.MessageText = "This is the message body"
SMTPControl.Send()
IPWorksSSLException
public void sendToTerminalAndEmail()
throws IPWorksSSLException
This method is similar to Send but requests also that the message is
sent to the terminal of the user as well, if he is logged on and accepts
terminal messages. This method requires
that AllowExtensions is set to True and is not supported by all
mail relays.
IPWorksSSLException
public void sendToTerminalOnly()
throws IPWorksSSLException
This method is similar to Send but requests instead that the message is
sent to the user's terminal.
An exception with the server's response is raised
if the user is not logged in or does not
accept terminal messages. This method requires
that AllowExtensions is set to True and is not supported by all
mail relays.
IPWorksSSLException
public void sendToTerminalOrEmail()
throws IPWorksSSLException
This method is similar to Send but requests instead that the message is
first sent to the user's terminal. If the user is not logged in or does not
accept terminal messages, the message is sent to his mailbox. This method requires
that AllowExtensions is set to True and is not supported by all
mail relays.
IPWorksSSLException
public void setMessageStream(java.io.InputStream messageStream)
throws IPWorksSSLException
This method sets the stream to be uploaded to the server as part of the message. If an upload stream is set before the Send method is called, the content of the stream will be read by the bean and uploaded to the server; The stream should be open and normally set to position 0.
The bean will automatically close this stream if ipworksssl.Smtps#config is set to true (default). If the stream is closed, you will need to call this method again before calling {@link ipworksssl.Smtps#send Send} again.
The content of the stream will be read from the current position all the way to the end.
Note: This method and {@link ipworksssl.Smtps#getLocalFile LocalFile} will reset the other.
IPWorksSSLException
public void verify(java.lang.String emailAddress)
throws IPWorksSSLException
This method asks the MailServer to verify the email address provided in the 'EmailAddress' parameter.
IPWorksSSLException
public void addSmtpsEventListener(SmtpsEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeSmtpsEventListener(SmtpsEventListener l)
|
IP*Works! SSL V9 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||