IP*Works! S/MIME V9

ipworkssmime
Class Shtmlmailer

java.lang.Object
  extended by ipworkssmime.Shtmlmailer

public class Shtmlmailer
extends java.lang.Object

The HTMLMailer Bean is used to send HTML email.

The bean sends a message (provided in MessageHTML and MessageText ). The HTML message may contain references to images which are automatically embedded into the message.

The MessageHTML property contains the HTML version of the message. The corresponding plain text version is provided into the MessageText property.

When MessageHTML is set, the bean automatically computes a plaintext version of the text and puts it into MessageText . You may choose to override this default text with your own version.

The recipients are specified by the SendTo , Cc , and BCc properties, and the message subject by the Subject property.

Once all the appropriate properties have been set call the Send method and your message will be sent to its intended recipient(s).

Other SMTP headers may be specified through the OtherHeaders property. Information about interaction with the server is provided via the PITrail event.


Field Summary
static int amCRAMMD5
           
static int amKerberos
           
static int amNTLM
           
static int amUserPassword
           
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
Shtmlmailer()
          Creates an instance of Shtmlmailer Bean.
Shtmlmailer(java.lang.String runtimeLicense)
          Creates an instance of Shtmlmailer Bean with specified run-time license.
 
Method Summary
 void addAttachment(java.lang.String fileName)
          Adds FileName as an attachment.
 void addRecipientCert(byte[] certEncoded)
          Used to add recipient certificates used to encrypt messages.
 void addShtmlmailerEventListener(ShtmlmailerEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a 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 encrypt()
          Encrypts the current Message .
 FileAttachmentList getAttachments()
          The paths of files to attach to the message.
 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).
 Certificate getCertificate()
          The current selected certificate.
 java.lang.String getDeliveryNotificationTo()
          Email address to send to which to send a delivery notification.
 java.lang.String getEncryptingAlgorithm()
          Textual description of the encrypting algorithm.
 Firewall getFirewall()
          A set of properties related to firewall access.
 java.lang.String getFrom()
          The email address of the sender (required).
 java.lang.String getHTMLFile()
          The path to a local HTML file.
 HTMLImageList getImages()
          The embedded images in the HTML message.
 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).
 java.lang.String getMessageDate()
          Date of the mail message (optional).
 java.lang.String getMessageHTML()
          The HTML version 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 plain text version of the message.
 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 getSendTo()
          A comma separated list of addresses for destinations (required).
 int getSensitivity()
          Sensitivity of the mail message (optional).
 java.lang.String getSigningAlgorithm()
          Textual description of the signature hash algorithm.
 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 isConnected()
          Shows whether the bean is connected.
 boolean isIdle()
          The current status of the component.
 boolean isIncludeChain()
          Specifies whether to include the signer's certificate chain with the signed message.
 boolean isParseHTML()
          Controls the behavior of the MessageHTML property.
 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 removeShtmlmailerEventListener(ShtmlmailerEventListener l)
           
 void resetHeaders()
          Resets all the message headers to empty.
 void send()
          Sends the current message and MIME encoded attachment.
 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 setCertificate(Certificate certificate)
          The current selected certificate.
 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 setEncryptingAlgorithm(java.lang.String encryptingAlgorithm)
          Textual description of the encrypting algorithm.
 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 setHTMLFile(java.lang.String HTMLFile)
          The path to a local HTML file.
 void setImportance(int importance)
          Importance of the mail message (optional).
 void setIncludeChain(boolean includeChain)
          Specifies whether to include the signer's certificate chain with the signed message.
 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 setMessageDate(java.lang.String messageDate)
          Date of the mail message (optional).
 void setMessageHTML(java.lang.String messageHTML)
          The HTML version of the message.
 void setMessageHTMLStream(java.io.InputStream messageStream)
          Sets the stream from which the bean will read the HTML version of the message.
 void setMessageId(java.lang.String messageId)
          The Message Identifier for the message.
 void setMessageText(java.lang.String messageText)
          The plain text version of the message.
 void setOtherHeaders(java.lang.String otherHeaders)
          An RFC 822 compliant string consisting of extra headers.
 void setParseHTML(boolean parseHTML)
          Controls the behavior of the MessageHTML property.
 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 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 setSigningAlgorithm(java.lang.String signingAlgorithm)
          Textual description of the signature hash algorithm.
 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 sign()
          Signs the current Message .
 void signAndEncrypt()
          Signs and encrypts the current Message .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amUserPassword

public static final int amUserPassword
See Also:
Constant Field Values

amCRAMMD5

public static final int amCRAMMD5
See Also:
Constant Field Values

amNTLM

public static final int amNTLM
See Also:
Constant Field Values

amKerberos

public static final int amKerberos
See Also:
Constant Field Values

miUnspecified

public static final int miUnspecified
See Also:
Constant Field Values

miHigh

public static final int miHigh
See Also:
Constant Field Values

miNormal

public static final int miNormal
See Also:
Constant Field Values

miLow

public static final int miLow
See Also:
Constant Field Values

epUnspecified

public static final int epUnspecified
See Also:
Constant Field Values

epNormal

public static final int epNormal
See Also:
Constant Field Values

epUrgent

public static final int epUrgent
See Also:
Constant Field Values

epNonUrgent

public static final int epNonUrgent
See Also:
Constant Field Values

esUnspecified

public static final int esUnspecified
See Also:
Constant Field Values

esPersonal

public static final int esPersonal
See Also:
Constant Field Values

esPrivate

public static final int esPrivate
See Also:
Constant Field Values

esCompanyConfidential

public static final int esCompanyConfidential
See Also:
Constant Field Values

sslAutomatic

public static final int sslAutomatic
See Also:
Constant Field Values

sslImplicit

public static final int sslImplicit
See Also:
Constant Field Values

sslExplicit

public static final int sslExplicit
See Also:
Constant Field Values

sslNone

public static final int sslNone
See Also:
Constant Field Values
Constructor Detail

Shtmlmailer

public Shtmlmailer()
Creates an instance of Shtmlmailer Bean.


Shtmlmailer

public Shtmlmailer(java.lang.String runtimeLicense)
Creates an instance of Shtmlmailer Bean with specified run-time license.

Method Detail

getAttachments

public FileAttachmentList getAttachments()
The paths of files to attach to the message.

This property contains the path of a file on your system that you would like to send as an attachment with your message. The bean will open the file and encode its contents in MIME format.

Example (Adding an Attachment)

 Control.AddAttachment("C:\file1.zip")
 Control.AddAttachment("C:\file2.zip")
 Control.Send() 
or Example (Using Attachments Collection)

 Control.Attachments.Add(New nsoftware.IPWorks.FileAttachment("name", "C:\file.txt")) 

This collection is indexed from 0 to size - 1.


getAuthMechanism

public int getAuthMechanism()
Used when connecting to the mail server.

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.


setAuthMechanism

public void setAuthMechanism(int authMechanism)
                      throws IPWorksSMIMEException
Used when connecting to the mail server.

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.

Throws:
IPWorksSMIMEException

getBCc

public java.lang.String getBCc()
A comma separated list of addresses for blind carbon copies (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.


setBCc

public void setBCc(java.lang.String BCc)
            throws IPWorksSMIMEException
A comma separated list of addresses for blind carbon copies (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.

Throws:
IPWorksSMIMEException

getCc

public java.lang.String getCc()
A comma separated list of addresses for carbon copies (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.


setCc

public void setCc(java.lang.String cc)
           throws IPWorksSMIMEException
A comma separated list of addresses for carbon copies (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.

Throws:
IPWorksSMIMEException

getCertificate

public Certificate getCertificate()
The current selected certificate.

This property is populated when a specified certificate is found or loaded by the bean. This property is used for specifying private keys. Set this property to a valid Certificate object to perform different operations such as Sign , Decrypt , SignAndEncrypt , or DecryptAndVerifySignature . To set a certificate, you may set the Encoded field to the encoded certificate. To select a certificate, use the Store and Subject fields.


setCertificate

public void setCertificate(Certificate certificate)
                    throws IPWorksSMIMEException
The current selected certificate.

This property is populated when a specified certificate is found or loaded by the bean. This property is used for specifying private keys. Set this property to a valid Certificate object to perform different operations such as Sign , Decrypt , SignAndEncrypt , or DecryptAndVerifySignature . To set a certificate, you may set the Encoded field to the encoded certificate. To select a certificate, use the Store and Subject fields.

Throws:
IPWorksSMIMEException

setCommand

public void setCommand(java.lang.String command)
                throws IPWorksSMIMEException
Used to send additional commands directly to the server.

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.

Throws:
IPWorksSMIMEException

isConnected

public boolean isConnected()
Shows whether the bean is connected.

This property is used to determine whether or not the bean is connected to the remote host.


setConnected

public void setConnected(boolean connected)
                  throws IPWorksSMIMEException
Shows whether the bean is connected.

This property is used to determine whether or not the bean is connected to the remote host.

Throws:
IPWorksSMIMEException

getDeliveryNotificationTo

public java.lang.String getDeliveryNotificationTo()
Email address to send to which to send a delivery notification.

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.


setDeliveryNotificationTo

public void setDeliveryNotificationTo(java.lang.String deliveryNotificationTo)
                               throws IPWorksSMIMEException
Email address to send to which to send a delivery notification.

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.

Throws:
IPWorksSMIMEException

getEncryptingAlgorithm

public java.lang.String getEncryptingAlgorithm()
Textual description of the encrypting algorithm.

This property contains either the name of the algorithm (such as "RC2", "3DES", "DES", or "AES"), or an object identifier (OID) string representing the algorithm.

In the case of "RC2" ("RC2CBC") the key bit length is specified after the name. The following algorithm names are supported for RC2: "RC2CBC40", "RC2CBC64", and "RC2CBC128", with the default being 128 bit ("RC2CBC128").

RC2 is not supported in the Java edition.

In the case of "AES" ("AESCBC") the key bit length is specified after the name. The following algorithm names are supported for AES: "AESCBC128", "AESCBC192", and "AESCBC256", with the default being 128 bit ("AESCBC128").

When read, the value of the property always contains the OID of the algorithm, or an empty string if the algorithm is unknown.


setEncryptingAlgorithm

public void setEncryptingAlgorithm(java.lang.String encryptingAlgorithm)
                            throws IPWorksSMIMEException
Textual description of the encrypting algorithm.

This property contains either the name of the algorithm (such as "RC2", "3DES", "DES", or "AES"), or an object identifier (OID) string representing the algorithm.

In the case of "RC2" ("RC2CBC") the key bit length is specified after the name. The following algorithm names are supported for RC2: "RC2CBC40", "RC2CBC64", and "RC2CBC128", with the default being 128 bit ("RC2CBC128").

RC2 is not supported in the Java edition.

In the case of "AES" ("AESCBC") the key bit length is specified after the name. The following algorithm names are supported for AES: "AESCBC128", "AESCBC192", and "AESCBC256", with the default being 128 bit ("AESCBC128").

When read, the value of the property always contains the OID of the algorithm, or an empty string if the algorithm is unknown.

Throws:
IPWorksSMIMEException

getFirewall

public Firewall getFirewall()
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.


setFirewall

public void setFirewall(Firewall firewall)
                 throws IPWorksSMIMEException
A set of properties related to firewall access.

This is a Firewall type property which contains fields describing the firewall through which the bean will attempt to connect.

Throws:
IPWorksSMIMEException

getFrom

public java.lang.String getFrom()
The email address of the sender (required).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.


setFrom

public void setFrom(java.lang.String from)
             throws IPWorksSMIMEException
The email address of the sender (required).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

Throws:
IPWorksSMIMEException

getHTMLFile

public java.lang.String getHTMLFile()
The path to a local HTML file.

This property may contain the path to the local HTML file. If this property is not empty, the contents of the file with that name will be appended to the text in MessageHTML .

Note that this means that if MessageHTML is empty, HTMLFile is what will be sent to the server.


setHTMLFile

public void setHTMLFile(java.lang.String HTMLFile)
                 throws IPWorksSMIMEException
The path to a local HTML file.

This property may contain the path to the local HTML file. If this property is not empty, the contents of the file with that name will be appended to the text in MessageHTML .

Note that this means that if MessageHTML is empty, HTMLFile is what will be sent to the server.

Throws:
IPWorksSMIMEException

isIdle

public boolean isIdle()
The current status of the component.

Idle will be False if the component is currently busy (communicating and/or waiting for an answer), and True at all other times.


getImages

public HTMLImageList getImages()
The embedded images in the HTML message.

This property contains the names of the image files embedded into the HTML message. The collection is updated every time MessageHTML is set. You may change the file names prior to sending (e.g. if they don't point to valid files).

This collection is indexed from 0 to size - 1.


getImportance

public int getImportance()
Importance of the mail message (optional).

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).


setImportance

public void setImportance(int importance)
                   throws IPWorksSMIMEException
Importance of the mail message (optional).

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).

Throws:
IPWorksSMIMEException

isIncludeChain

public boolean isIncludeChain()
Specifies whether to include the signer's certificate chain with the signed message.

If this property is set to True, the entire certificate's chain that was used to sign the message will be encoded and included in the message signature when calling Sign or SignAndEncrypt .

NOTE: To include the chain, the IncludeCertificate property must also be set to true.


setIncludeChain

public void setIncludeChain(boolean includeChain)
                     throws IPWorksSMIMEException
Specifies whether to include the signer's certificate chain with the signed message.

If this property is set to True, the entire certificate's chain that was used to sign the message will be encoded and included in the message signature when calling Sign or SignAndEncrypt .

NOTE: To include the chain, the IncludeCertificate property must also be set to true.

Throws:
IPWorksSMIMEException

getLastReply

public java.lang.String getLastReply()
The last reply from the server.

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.


getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

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.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksSMIMEException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

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.

Throws:
IPWorksSMIMEException

getMailPort

public int getMailPort()
The server port for SMTP (default 25).

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.


setMailPort

public void setMailPort(int mailPort)
                 throws IPWorksSMIMEException
The server port for SMTP (default 25).

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.

Throws:
IPWorksSMIMEException

getMailServer

public java.lang.String getMailServer()
The name or address of a mail server (mail relay).

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.


setMailServer

public void setMailServer(java.lang.String mailServer)
                   throws IPWorksSMIMEException
The name or address of a mail server (mail relay).

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.

Throws:
IPWorksSMIMEException

getMessageDate

public java.lang.String getMessageDate()
Date of the mail message (optional).

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".


setMessageDate

public void setMessageDate(java.lang.String messageDate)
                    throws IPWorksSMIMEException
Date of the mail message (optional).

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".

Throws:
IPWorksSMIMEException

getMessageHTML

public java.lang.String getMessageHTML()
The HTML version of the message.

This property contains the HTML version of the message. The corresponding plain text version is provided in this property.

When this property is set, the bean automatically computes a plaintext version of the text and puts it into MessageText . You may choose to override this default text with your own version.

Example (Setting MessageHTML)

 HTMLMailerControl.MessageHTML = "<b>Hello</b>, my name is <i>Tom</i>" 


setMessageHTML

public void setMessageHTML(java.lang.String messageHTML)
                    throws IPWorksSMIMEException
The HTML version of the message.

This property contains the HTML version of the message. The corresponding plain text version is provided in this property.

When this property is set, the bean automatically computes a plaintext version of the text and puts it into MessageText . You may choose to override this default text with your own version.

Example (Setting MessageHTML)

 HTMLMailerControl.MessageHTML = "<b>Hello</b>, my name is <i>Tom</i>" 

Throws:
IPWorksSMIMEException

getMessageId

public java.lang.String getMessageId()
The Message Identifier for the message.

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.


setMessageId

public void setMessageId(java.lang.String messageId)
                  throws IPWorksSMIMEException
The Message Identifier for the message.

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.

Throws:
IPWorksSMIMEException

getMessageRecipients

public MessageRecipientList getMessageRecipients()
The collection of recipients of the message.

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.


getMessageText

public java.lang.String getMessageText()
The plain text version of the message.

This property is a plain text version of the HTML message. This is necessary for recipients with legacy mail readers that do not support HTML.

The MessageHTML property contains the HTML version of the message. When MessageHTML is set, the bean automatically computes a plain text version of the text and puts it into this property. You may choose to override this default text with your own version.


setMessageText

public void setMessageText(java.lang.String messageText)
                    throws IPWorksSMIMEException
The plain text version of the message.

This property is a plain text version of the HTML message. This is necessary for recipients with legacy mail readers that do not support HTML.

The MessageHTML property contains the HTML version of the message. When MessageHTML is set, the bean automatically computes a plain text version of the text and puts it into this property. You may choose to override this default text with your own version.

Throws:
IPWorksSMIMEException

getOtherHeaders

public java.lang.String getOtherHeaders()
An RFC 822 compliant string consisting of extra headers.

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() 


setOtherHeaders

public void setOtherHeaders(java.lang.String otherHeaders)
                     throws IPWorksSMIMEException
An RFC 822 compliant string consisting of extra headers.

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() 

Throws:
IPWorksSMIMEException

isParseHTML

public boolean isParseHTML()
Controls the behavior of the MessageHTML property.

This property controls the behavior of the MessageHTML property. If ParseHTML is set to False, you must provide valid values in MessageHTML , MessageText , and Images .


setParseHTML

public void setParseHTML(boolean parseHTML)
                  throws IPWorksSMIMEException
Controls the behavior of the MessageHTML property.

This property controls the behavior of the MessageHTML property. If ParseHTML is set to False, you must provide valid values in MessageHTML , MessageText , and Images .

Throws:
IPWorksSMIMEException

getPassword

public java.lang.String getPassword()
A password for logon to the 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.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksSMIMEException
A password for logon to the 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.

Throws:
IPWorksSMIMEException

getPriority

public int getPriority()
Priority of the mail message (optional).

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.


setPriority

public void setPriority(int priority)
                 throws IPWorksSMIMEException
Priority of the mail message (optional).

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.

Throws:
IPWorksSMIMEException

getReadReceiptTo

public java.lang.String getReadReceiptTo()
Email address to send a read receipt to.

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.


setReadReceiptTo

public void setReadReceiptTo(java.lang.String readReceiptTo)
                      throws IPWorksSMIMEException
Email address to send a read receipt to.

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.

Throws:
IPWorksSMIMEException

getReplyTo

public java.lang.String getReplyTo()
A mail address to which to reply (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.


setReplyTo

public void setReplyTo(java.lang.String replyTo)
                throws IPWorksSMIMEException
A mail address to which to reply (optional).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

Throws:
IPWorksSMIMEException

getSendTo

public java.lang.String getSendTo()
A comma separated list of addresses for destinations (required).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.


setSendTo

public void setSendTo(java.lang.String sendTo)
               throws IPWorksSMIMEException
A comma separated list of addresses for destinations (required).

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 MaxHeaderLength , then it is folded according to RFC 822 specifications.

NOTE: You must clear the MessageRecipients collection before setting this property to remove previous recipients.

Throws:
IPWorksSMIMEException

getSensitivity

public int getSensitivity()
Sensitivity of the mail message (optional).

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).


setSensitivity

public void setSensitivity(int sensitivity)
                    throws IPWorksSMIMEException
Sensitivity of the mail message (optional).

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).

Throws:
IPWorksSMIMEException

getSigningAlgorithm

public java.lang.String getSigningAlgorithm()
Textual description of the signature hash algorithm.

This property specifies the hash algorithm used to prepare the message digest for signature.

This property must contain either the name of the algorithm (such as "MD5" or "SHA1"), or an object id (OID) string representing the hash algorithm.

When read, the value of the property always contains the OID of the algorithm, or an empty string if the algorithm is unknown.


setSigningAlgorithm

public void setSigningAlgorithm(java.lang.String signingAlgorithm)
                         throws IPWorksSMIMEException
Textual description of the signature hash algorithm.

This property specifies the hash algorithm used to prepare the message digest for signature.

This property must contain either the name of the algorithm (such as "MD5" or "SHA1"), or an object id (OID) string representing the hash algorithm.

When read, the value of the property always contains the OID of the algorithm, or an empty string if the algorithm is unknown.

Throws:
IPWorksSMIMEException

getSSLAcceptServerCert

public Certificate getSSLAcceptServerCert()
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.

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.


setSSLAcceptServerCert

public void setSSLAcceptServerCert(Certificate SSLAcceptServerCert)
                            throws IPWorksSMIMEException
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate.

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.

Throws:
IPWorksSMIMEException

getSSLCert

public Certificate getSSLCert()
The certificate to be used during SSL negotiation.

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.


setSSLCert

public void setSSLCert(Certificate SSLCert)
                throws IPWorksSMIMEException
The certificate to be used during SSL negotiation.

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.

Throws:
IPWorksSMIMEException

getSSLServerCert

public Certificate getSSLServerCert()
The server certificate for the last established connection.

SSLServerCert contains the server certificate for the last established connection.

SSLServerCert is reset every time a new connection is attempted.


getSSLStartMode

public int getSSLStartMode()
Determines how the bean starts the SSL negotiation.

The SSLStartMode property may have one of the following values:

0 (sslAutomatic)
If the remote port is set to the standard plaintext port of the protocol (where applicable), the bean will behave the same as if SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit ( sslImplicit ).
1 (sslImplicit)
The SSL negotiation will start immediately after the connection is established.
2 (sslExplicit)
The bean will first connect in plaintext, and then explicitly start SSL negotiation through a protocol command such as STARTTLS.
3 (sslNone - default)
No SSL negotiation, no SSL security. All communication will be in plaintext mode.


setSSLStartMode

public void setSSLStartMode(int SSLStartMode)
                     throws IPWorksSMIMEException
Determines how the bean starts the SSL negotiation.

The SSLStartMode property may have one of the following values:

0 (sslAutomatic)
If the remote port is set to the standard plaintext port of the protocol (where applicable), the bean will behave the same as if SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit ( sslImplicit ).
1 (sslImplicit)
The SSL negotiation will start immediately after the connection is established.
2 (sslExplicit)
The bean will first connect in plaintext, and then explicitly start SSL negotiation through a protocol command such as STARTTLS.
3 (sslNone - default)
No SSL negotiation, no SSL security. All communication will be in plaintext mode.

Throws:
IPWorksSMIMEException

getSubject

public java.lang.String getSubject()
The subject of the mail message (optional).

The string in this property is sent with a Subject SMTP header to the mail recipient.

If the resulting header is longer than MaxHeaderLength , then it is folded according to RFC 822 specifications.


setSubject

public void setSubject(java.lang.String subject)
                throws IPWorksSMIMEException
The subject of the mail message (optional).

The string in this property is sent with a Subject SMTP header to the mail recipient.

If the resulting header is longer than MaxHeaderLength , then it is folded according to RFC 822 specifications.

Throws:
IPWorksSMIMEException

getTimeout

public int getTimeout()
A timeout for the bean.

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 AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).


setTimeout

public void setTimeout(int timeout)
                throws IPWorksSMIMEException
A timeout for the bean.

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 AbsoluteTimeout configuration setting.

The default value for the Timeout property is 60 (seconds).

Throws:
IPWorksSMIMEException

getUser

public java.lang.String getUser()
A user identifier to login as in the 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.


setUser

public void setUser(java.lang.String user)
             throws IPWorksSMIMEException
A user identifier to login as in the 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.

Throws:
IPWorksSMIMEException

addAttachment

public void addAttachment(java.lang.String fileName)
                   throws IPWorksSMIMEException
Adds FileName as an attachment.

This method adds the file name as an attachment, the full list of attachments is contained in the Attachments property.

Example (Adding an Attachment)

 Control.AddAttachment("C:\file1.zip")
 Control.AddAttachment("C:\file2.zip")
 Control.Send() 
or Example (Using Attachments Collection)

 Control.Attachments.Add(New nsoftware.IPWorks.FileAttachment("name", "C:\file.txt")) 

Throws:
IPWorksSMIMEException

addRecipientCert

public void addRecipientCert(byte[] certEncoded)
                      throws IPWorksSMIMEException
Used to add recipient certificates used to encrypt messages.

This method is used to add recipient certificates to the internal MessageRecipients collection used to encrypt the Message . The recipient certificate must be a valid PKCS encoded certificate. If the certificate provided is Base64 encoded it will be decoded first by the object.

The CertMgr bean may be used to retrieve the appropriate certificate from the system.

Throws:
IPWorksSMIMEException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksSMIMEException
Sets or retrieves a configuration setting.

Config is a generic method available in every bean. It is used to set and retrieve configuration settings for the bean.

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 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 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 Config method.

HTMLMailer Configuration Settings

Charset
When set, the charset Content-Type attribute will be added using the specified value
This property is used to specify the "charset" Content-Type attribute for both the HTML ( MessageHTML ) and plain text ( MessageText ) part headers. The default value is "" (empty string) in which case the charset attribute will not be added to the Content-Type header.
MessageTextEncoding
When set, the MessageHTML and MessageText values will be encoded using the specified encoding
When set to one of the below integer values, both the MessageHTML and MessageText properties will be encoded using the specified encoding. The "Content-Transfer-Encoding" header will also be set for both the HTML and plain text parts. The following encodings are supported:
0
7-bit
1
Quoted-Printable
2
Base64
3
8-bit
UseTempFile
Determines if temporary files are used during message creation
When true the bean will create temporary files on disk at the path specified by TempFilePath as necessary during message creation. Set this to False to disable the creation of temporary files. When set to False the message will be created entirely in memory. The default value is True.
AttachmentType[index]
Content-type for attached file (at index)
This configuration setting allows you to set the Content-Type for each attached file in the Attachments array property. Valid array indices are from 0 to AttachmentCount - 1. To set the Content-Type for the attachment at index 2 you would set the string "AttachmentType[2]=application/octet-stream".
OverrideFilename
If set to true, the AttachmentName property value will be used to set the MIME part Filename attribute
When set to true, the Name value specified will be used to set the Filename attribute of the Content-Disposition header. The default value is False, in which case the component will use the same name as the file being added.
TempFilePath
If set, the temporary files created during message creation will be put in the path specified
The TempFilePath configuration sets the path at which the temporary files will be created.
UseTempFile
If set, the bean uses temporary files when generating messages
This controls whether or not the bean will use a temporary file when creating messages to be sent. Set this to true if the outgoing message contains large images or attachments.NOTE: Be aware of security considerations when using this configuration.

SMTP Configuration Settings

AllowEmptyTo
If set to True, then the property is not required
Normally, the SendTo property is required to send a message. If AllowEmptyTo is True, then this is not the case, and messages can be sent with just one or both of Cc and BCc set.
Charset
When set, the message headers will be encoded using the specified Charset
This property is used to specify the "charset" to be used to encode the message headers. For example, to use UTF-8 you can set this property to "UTF-8". The default value is "" (empty string) in which case the headers will not be encoded.
FoldHeaders
Tells the bean whether to fold the headers
If true, the bean will fold the headers if the headers are over a certain length. If false, the headers will be on one line regardless of length.Note that this is true by default.

Hello
The argument for HELO (herald) command to the server (defaults to local host name)
The Hello property specifies a string to send to the MailServer at connection time as an argument to the SMTP HELO command. This generally identifies the host sending mail, and that's why the Hello property defaults to the name of the local host. The property is provided in case the bean does not accept the default value and a custom value (such as, for example, a fully qualified domain name) must be sent.If AllowExtensions is true the EHLO command will be sent instead of the HELO command.

KeepQueue
If set to True, queued files are not deleted after a successful send
Normally, ProcessQueue deletes queued files after processing them. If KeepQueue is True, the file extension is instead changed to ".sent" and the files are not deleted.
MaxHeaderLength
Maximum length for headers to avoid line folding (default 80)
The MaxHeaderLength specifies the maximum line length supported by the mail delivery system. Any headers longer than MaxHeaderLength are folded as specified in RFC 822.It is generally a good idea to use a MaxHeaderLength of less than 100 bytes, although different mail relays and mail servers have different requirements for header lengths.

OtherHeaders
An RFC 822 compliant string consisting of extra headers
This is the same as the OtherHeaders property. This setting is exposed here for use by beans that inherit from SMTP.
ReturnPath
Sets the Return-Path to be used for sending email
This is the same as the ReturnPath property. This setting is exposed here for use by beans that inherit from SMTP.
StopOnToErrors
Instructs the component to stop sending the message if the server does not acknowledge any of the TOs
If this setting is set to true, the component will fail the moment the server does not acknowledge a To address. If set to false, an error will be fired for every To that is not recognized by the server, but the message will be sent to the rest of the recipients. The default value is true.
StopOnCcErrors
Instructs the component to stop sending the message if the server does not acknowledge any of the CCs
If this setting is set to true, the component will fail the moment the server does not acknowledge a Cc address. If set to false, an error will be fired for every Cc that is not recognized by the server, but the message will be sent to the rest of the recipients. The default value is true.
StopOnBccErrors
Instructs the component to stop sending the message if the server does not acknowledge any of the BCCs
If this setting is set to true, the component will fail the moment the server does not acknowledge a Bcc address. If set to false, an error will be fired for every Bcc that is not recognized by the server, but the message will be sent to the rest of the recipients. The default value is false.

IPPort Configuration Settings

FirewallAutoDetect
Tells the bean whether or not to automatically detect and use firewall system settings, if available
This is the same as AutoDetect . This setting is provided for use by beans that do not directly expose Firewall properties.
FirewallHost
Name or IP address of firewall (optional)
If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.If the FirewallHost setting is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost setting is set to the corresponding address. If the search is not successful, an error is returned.

NOTE: This is the same as Host . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallListener
If true, the component binds to a SOCKS firewall as a server (IPPort only)
This entry is for IPPort only and does not work for other components that descend from IPPort.If this entry is set, the bean acts as a server. RemoteHost and RemotePort are used to tell the SOCKS firewall in which address and port to listen to. The firewall rules may ignore RemoteHost , and it is recommended that RemoteHost be set to empty string in this case.

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 ConnectionStatus event.

The connection to the firewall is made by calling the Connect method.

FirewallPassword
Password to be used if authentication is to be used when connecting through the firewall
If FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the given firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as Password . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallPort
The TCP port for the FirewallHost;
Note that the FirewallPort is set automatically when FirewallType is set to a valid value.NOTE: This is the same as Port . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallType
Determines the type of firewall to connect through
The appropriate values are as follows:
0
No firewall (default setting).
1
Connect through a tunneling proxy. FirewallPort is set to 80.
2
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
3
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.
NOTE: This is the same as FirewallType . This setting is provided for use by beans that do not directly expose Firewall properties.

FirewallUser
A user name if authentication is to be used connecting through a firewall
If the FirewallHost is specified, the FirewallUser and FirewallPassword settings are used to connect and authenticate to the Firewall. If the authentication fails, the bean throws an exception.NOTE: This is the same as User . This setting is provided for use by beans that do not directly expose Firewall properties.

KeepAliveTime
The inactivity time in milliseconds before a TCP keep-alive packet is sent
When set, TCPKeepAlive will automatically be set to true. By default the operating system will determine the time a connection is idle before a TCP keep-alive packet is sent. This system default if this value is not specified here is 2 hours. In many cases a shorter interval is more useful. Set this value to the desired interval in milliseconds.Note: This value is not applicable in Java.

KeepAliveInterval
The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received
When set, TCPKeepAlive will automatically be set to true. A TCP keep-alive packet will be sent after a period of inactivity as defined by KeepAliveTime . If no acknowledgement is received from the remote host the keep-alive packet will be re-sent. This setting specifies the interval at which the successive keep-alive packets are sent in milliseconds. This system default if this value is not specified here is 1 second.Note: This value is not applicable in Java or MAC.

Linger
When set to True, connections are terminated gracefully
This property controls how a connection is closed. The default is True.In the case that Linger is True (default), there are two scenarios for determining how long the connection will linger. The first, if LingerTime is 0 (default), the system will attempt to send pending data for a connection until the default IP protocol timeout expires.

In the second scenario, LingerTime is a positive value, the system will attempt to send pending data until the specified LingerTime 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.

LingerTime
Time in seconds to have the connection linger
LingerTime is the time, in seconds, to leave the socket connection linger. This value is 0 by default, which means it will use the default IP protocol timeout.
LocalHost
The name of the local host through which connections are initiated or accepted
The LocalHost setting 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 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).

LocalPort
The TCP port in the local host where the bean binds
This must be set before a connection is attempted. It instructs the bean to bind to a specific port (or communication endpoint) in the local machine.Setting this to 0 (default) enables the system to choose a port at random. The chosen port will be shown by LocalPort after the connection is established.

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.

MaxLineLength
The maximum amount of data to accumulate when no EOL is found
MaxLineLength is the size of an internal buffer, which holds received data while waiting for an EOL string.If an EOL string is found in the input stream before MaxLineLength bytes are received, the DataIn event is fired with the EOL parameter set to True, and the buffer is reset.

If no EOL is found, and MaxLineLength bytes are accumulated in the buffer, the DataIn event is fired with the EOL parameter set to False, and the buffer is reset.

The minimum value for MaxLineLength is 256 bytes. The default value is 2048 bytes. The maximum value is 65536 bytes.

MaxTransferRate
The transfer rate limit in bytes per second
This setting can be used to throttle outbound TCP traffic. Set this to the number of bytes to be sent per second. By default this is not set and there is no limit.
TCPKeepAlive
Determines whether or not the keep alive socket option is enabled
If set to true, the socket's keep-alive option is enabled and keep-alive packets will be sent periodically to maintain the connection. Set KeepAliveTime and KeepAliveInterval to configure the timing of the keep-alive packets.Note: This value is not applicable in Java.

UseIPv6
Whether or not to use IPv6
By default, the component expects an IPv4 address for local and remote host properties, and will create an IPv4 socket. To use IPv6 instead, set this to True.
CloseStreamAfterTransfer
If true, the component will close the upload or download stream after the transfer
This entry is for bean and all the components that descend from it.This property is true by default. Therefore, by default, all streams will be closed after a transfer is completed. In order to keep streams open after the transfer of data, you must set this config to false.

TcpNoDelay
Whether or not to delay when sending packets
When true, the socket will send all data that is ready to send at once. When false, the socket will send smaller buffered packets of data at small intervals. This is known as the Nagle algorithm.By default, this config is set to false.

SSL Configuration Settings

ReuseSSLSession
Determines if the SSL session is reused
If set to true, the component will reuse the context if and only if the following criteria are met:
  • The target host name is the same.
  • The system cache entry has not expired (default timeout is 10 hours).
  • The application process that calls the function is the same.
  • The logon session is the same.
  • The instance of the component is the same.

SSLCipherStrength
The minimum cipher strength used for bulk encryption
This minimum cipher strength largely dependent on the security modules installed on the system. If the cipher strength specified is not supported, an error will be returned when connections are initiated.Please note that this setting contains the minimum cipher strength requested from the security library. The actual cipher strength used for the connection is shown by the SSLStatus event.

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 OpenSSLCipherList config setting.

SSLEnabledProtocols
Used to enable/disable the supported security protocols
Used to enable/disable the supported security protocols.Not all supported protocols are enabled by default (the value of this setting is 240). If you want more granular control over the enabled protocols, you can set this property to the binary 'OR' of one or more of the following values:
TLS1.2
3072 (Hex C00)
TLS1.1
768 (Hex 300)
TLS1
192 (Hex C0) (Default)
SSL3
48 (Hex 30) (Default)
SSL2
12 (Hex 0C)
Please note that although a number of sites still support SSL2, it is usually a good idea to disable it because of potential security vulnerabilities.

When the provider is OpenSSL, SSLCipherStrength is currently not supported. This functionality is instead made available through the OpenSSLCipherList config setting.

TLS 1.1 and TLS1.2 support are only available starting with Windows 7.

NOTE: setting the property to 0 has the same effect as setting it to 4095 (enables all protocols).

SSLProvider
The name of the security provider to use
Change this setting to use security providers other than the system default.Use this setting with caution. Disabling SSL security or pointing to the wrong provider could potentially cause serious security vulnerabilities in your application.

The special value "*" (default) picks the default SSL provider defined in the system. On Windows, this is "Microsoft Unified Security Protocol Provider".

SSLSecurityFlags
Flags that control certificate verification
The following flags are defined (specified in hexadecimal notation). They can be or-ed together to exclude multiple conditions:
0x00000001
Ignore time validity status of certificate.
0x00000002
Ignore time validity status of CTL.
0x00000004
Ignore non-nested certificate times.
0x00000010
Allow unknown Certificate Authority.
0x00000020
Ignore wrong certificate usage.
0x00000100
Ignore unknown certificate revocation status.
0x00000200
Ignore unknown CTL signer revocation status.
0x00000400
Ignore unknown Certificate Authority revocation status.
0x00000800
Ignore unknown Root revocation status.
0x00008000
Allow test Root certificate.
0x00004000
Trust test Root certificate.
0x80000000
Ignore non-matching CN (certificate CN not-matching server name).
This functionality is currently not available in Java or when the provider is OpenSSL.

SSLContextProtocol
The protocol used when getting an SSLContext instance
SSLEnabledCipherSuites
The cipher suite to be used in an SSL negotiation
The enabled cipher suites to be used in SSL negotiation.By default, the enabled cipher suites will include all available ciphers ("*").

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.

Some sample settings:

 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:
  • SSL_RSA_WITH_NULL_MD5
  • SSL_RSA_WITH_NULL_SHA
  • SSL_RSA_EXPORT_WITH_RC4_40_MD5
  • SSL_RSA_WITH_RC4_128_MD5
  • SSL_RSA_WITH_RC4_128_SHA
  • SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5
  • SSL_RSA_WITH_IDEA_CBC_SHA
  • SSL_RSA_EXPORT_WITH_DES40_CBC_SHA
  • SSL_RSA_WITH_DES_CBC_SHA
  • SSL_RSA_WITH_3DES_EDE_CBC_SHA
  • SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
  • SSL_DH_DSS_WITH_DES_CBC_SHA
  • SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA
  • SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
  • SSL_DH_RSA_WITH_DES_CBC_SHA
  • SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA
  • SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
  • SSL_DHE_DSS_WITH_DES_CBC_SHA
  • SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
  • SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
  • SSL_DHE_RSA_WITH_DES_CBC_SHA
  • SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
  • SSL_DH_anon_EXPORT_WITH_RC4_40_MD5
  • SSL_DH_anon_WITH_RC4_128_MD5
  • SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA
  • SSL_DH_anon_WITH_DES_CBC_SHA
  • SSL_DH_anon_WITH_3DES_EDE_CBC_SHA

SSLEnabledCipherSuites is used together with SSLCipherStrength .

NOTE: This configuration setting is available only for Java products. Possible values are SSL, SSLv2, SSLv3, TLS and TLSv1. Use it only in case your security provider does not support TLS. This is the parameter "protocol" inside the SSLContext.getInstance(protocol) call.

SSLTrustManagerFactoryAlgorithm
The algorithm to be used to create a TrustManager through TrustManagerFactory
Possible values include SunX509. This is the parameter "algorithm" inside the TrustManagerFactory.getInstance(algorithm) call.

Socket Configuration Settings

AbsoluteTimeout
Determines whether timeouts are inactivity timeouts or absolute timeouts
If AbsoluteTimeout is set to True, any method which does not complete within Timeout seconds will be aborted. By default, AbsoluteTimeout is False, and the timeout is an inactivity timeout.Note: This option is not valid for UDP ports.

FirewallData
Used to send extra data to the firewall
When the firewall is a tunneling proxy, use this property to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).
InBufferSize
The size in bytes of the incoming queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the InBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

OutBufferSize
The size in bytes of the outgoing queue of the socket
This is the size of an internal queue in the TCP/IP stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize setting can provide significant improvements in performance in some cases.Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the bean is activated the OutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small.

Base Configuration Settings

GUIAvailable
Tells the bean whether or not a message loop is available for processing events
In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The bean will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the bean does not attempt to process external events.

Throws:
IPWorksSMIMEException

connect

public void connect()
             throws IPWorksSMIMEException
Connects to the mail relay and sends the SMTP HELO command.

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() 

Throws:
IPWorksSMIMEException

disconnect

public void disconnect()
                throws IPWorksSMIMEException
Disconnects from the SMTP server.

This method disconnects from the mail relay.

Throws:
IPWorksSMIMEException

doEvents

public void doEvents()
              throws IPWorksSMIMEException
Processes events from the internal message queue.

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.

Throws:
IPWorksSMIMEException

encrypt

public void encrypt()
             throws IPWorksSMIMEException
Encrypts the current Message .

This method encrypts the current data in Message in a PKCS encoded envelope with all of the recipient certificates specified in the MessageRecipients collection .

The result of the encrypted data will be replaced in the Message property and the MessageHeaders property will be filled with the required S/MIME headers.

Please note that the message headers, including the Sender, Recipient(s), and Subject, are not encrypted. If this is sensitive information, consider including these headers in the message body as a MIME entity, and providing other headers for the S/MIME wrapper.

Throws:
IPWorksSMIMEException

interrupt

public void interrupt()
               throws IPWorksSMIMEException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns, doing nothing.

Throws:
IPWorksSMIMEException

processQueue

public void processQueue(java.lang.String queueDir)
                  throws IPWorksSMIMEException
Sends the messages which have previously been queued into QueueDir .

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 KeepQueue configuration setting is set to True, in which case the file extension is instead changed to ".sent" and the queue file is not deleted.

Throws:
IPWorksSMIMEException

queue

public java.lang.String queue(java.lang.String queueDir)
                       throws IPWorksSMIMEException
Queues the message into QueueDir .

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.

Throws:
IPWorksSMIMEException

resetHeaders

public void resetHeaders()
                  throws IPWorksSMIMEException
Resets all the message headers to empty.

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.

Throws:
IPWorksSMIMEException

send

public void send()
          throws IPWorksSMIMEException
Sends the current message and MIME encoded attachment.

This method sends the current message and MIME encoded attachment. 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 HTML Email)

 HTMLMailerControl.MailServer = "myserver"
 HTMLMailerControl.SendTo = "recipient@myserver.com"
 HTMLMailerControl.From = "me@myserver.com"
 HTMLMailerControl.Subject = "My Subject"
 HTMLMailerControl.MessageHTML = "<b>Hello</b>, my name is <i>Tom</i>"
 HTMLMailerControl.Send 

Throws:
IPWorksSMIMEException

setMessageHTMLStream

public void setMessageHTMLStream(java.io.InputStream messageStream)
                          throws IPWorksSMIMEException
Sets the stream from which the bean will read the HTML version of the message.

This method sets the stream from which the bean will read the HTML version of the message. Once set, the bean reads the contents of the stream, and populates the MessageHTML property with the HTML version of the message. The corresponding plain text version is provided into the MessageText property.

When this property is called, the bean automatically computes a plaintext version of the text and puts it into MessageText . You may choose to override this default text with your own version.

Throws:
IPWorksSMIMEException

sign

public void sign()
          throws IPWorksSMIMEException
Signs the current Message .

This method digitally signs the current data included in Message with the the certificate provided. Certificates are provided by specifying the Certificate property. The IncludeCertificate and DetachedSignature properties allow you to specify addition details about what to include when signing the message.

The result of the signed data will be replaced in the Message property and the MessageHeaders property will be filled with the required S/MIME headers.

Throws:
IPWorksSMIMEException

signAndEncrypt

public void signAndEncrypt()
                    throws IPWorksSMIMEException
Signs and encrypts the current Message .

This method both signs and encrypts the message data included in Message into a single PKCS encoded envelope. The value in DetachedSignature is ignored: the bean will always generate an attached signature when calling this method. All other properties used by calling the Sign and Encrypt methods are used in the same manner.

The result of the encrypted data will be replaced in the Message property and the MessageHeaders property will be filled with the required S/MIME headers.

Please note that the message headers, including the Sender, Recipient(s), and Subject, are not encrypted. If this is sensitive information, consider including these headers in the message body as a MIME entity, and providing other headers for the S/MIME wrapper.

Throws:
IPWorksSMIMEException

addShtmlmailerEventListener

public void addShtmlmailerEventListener(ShtmlmailerEventListener l)
                                 throws java.util.TooManyListenersException
Throws:
java.util.TooManyListenersException

removeShtmlmailerEventListener

public void removeShtmlmailerEventListener(ShtmlmailerEventListener l)

IP*Works! S/MIME V9

Copyright (c) 2013 /n software inc. - All rights reserved.