Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.gateway
Class SmtpExporter

java.lang.Object
  extended by com.jivesoftware.forum.gateway.SmtpExporter
All Implemented Interfaces:
GatewayExporter

public class SmtpExporter
extends java.lang.Object
implements GatewayExporter

A gateway that performs exports through SMTP.


Constructor Summary
SmtpExporter(ForumFactory factory, Forum forum, GatewaySettings gatewaySettings)
          Create a new SmtpExporter instance.
 
Method Summary
 void exportData(ForumMessage forumMessage)
          Export a forum message to a SMTP server.
 void exportData(ForumMessage[] forumMessage)
          Export an array of forum message to a SMTP server.
 java.lang.String getDefaultFromAddress()
          From email address to send mail from for export.
 java.lang.String getHost()
          Returns the SMTP host (eg mail.example.com).
 java.util.Date getLastExport()
          Last date this exporter completed
 java.lang.String getOrganization()
          Retrieves the Organization header for outbound smtp messages.
 java.lang.String getPassword()
          Returns the password that will be used when connecting to the SMTP server.
 int getPort()
          Returns the port number that will be used when connecting to the SMTP server.
 java.lang.String getReplyToAddress()
          Returns the reply to address for export.
 java.lang.String getSpecialCharacterSet()
          Returns the special encoding for the email output, or null.
 java.lang.String getToAddress()
          Returns the email address that messages will be sent to during exports.
 java.lang.String getUsername()
          Returns the username that will be used when connecting to the SMTP server.
 boolean isAllowExportAgain()
          Return whether this gateway will allow reexporting of messages or not.
 boolean isAttachmentsEnabled()
           
 boolean isDebugEnabled()
          Returns true if debugging is turned on for the email transport layers.
 boolean isEmailPrefEnabled()
          Returns true if a user's privacy setting on their email address should be obeyed when doing an export.
 boolean isFromAddressOnly()
          Returns true if the default from address should be used exclusively when sending email, ignoring the user's preferences.
 boolean isSSLEnabled()
          Checks to see if this gateway is configured for SSL connections to the SMTP server or not.
 boolean isUpdateMessageIDOnExport()
          Retrieve whether the gateway will update the messageID message property stored in Jive upon export of a message.
 void setAllowExportAgain(boolean allowExportAgain)
          By default this gateway refuses to re-export a message which has previously been exported or imported or which was automatically created for threading purposes by an import gateway.
 void setAttachmentsEnabled(boolean attachmentsEnabled)
           
 void setDebugEnabled(boolean debugEnabled)
          Toggles SMTP transport layer debugging on or off.
 void setDefaultFromAddress(java.lang.String address)
          Set the from email address for message export.
 void setEmailPrefEnabled(boolean enabled)
          Toggles whether a user's privacy setting on their email address should be obeyed when doing an export.
 void setFromAddressOnly(boolean enabled)
          Toggles whether to exclusively use the default from address when sending email and ignore the users's preferences.
 void setHost(java.lang.String host)
          Sets the SMTP host (eg mail.example.com).
 void setOrganization(java.lang.String organization)
          Sets the Organization header for outbound smtp messages.
 void setPassword(java.lang.String password)
          Sets the username that will be used when connecting to the SMTP server.
 void setPort(int port)
          Sets the port number that will be used when connecting to the SMTP server.
 void setReplyToAddress(java.lang.String address)
          Set the reply-to email address for message export.
 void setSpecialCharacterSet(java.lang.String specialCharacterSet)
          Sets the special encoding for the forum.
 void setSSLEnabled(boolean sslEnabled)
          Sets whether this gateway is configured for SSL connections to the SMTP server or not.
 void setToAddress(java.lang.String address)
          Sets the email address that messages will be sent to during exports.
 void setUpdateMessageIDOnExport(boolean updateMessageID)
          Sets whether the gateway will update the messageID message property stored in Jive upon export of a message.
 void setUsername(java.lang.String username)
          Sets the username that will be used when connecting to the SMTP server.
 void stop()
          Stop a running export.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmtpExporter

public SmtpExporter(ForumFactory factory,
                    Forum forum,
                    GatewaySettings gatewaySettings)
Create a new SmtpExporter instance.

Method Detail

exportData

public void exportData(ForumMessage forumMessage)
                throws GatewayException
Export a forum message to a SMTP server.

NOTE: It is imperative that parent messages get exported prior to children messages so that the proper message headers can be set. Failure to do this will result in messages that may not be threaded properly when viewed using a mailreader.

Specified by:
exportData in interface GatewayExporter
Parameters:
forumMessage - the message to export.
Throws:
GatewayException - if a connection was unable to be established.

exportData

public void exportData(ForumMessage[] forumMessage)
                throws GatewayException
Export an array of forum message to a SMTP server.

NOTE: It is imperative that parent messages get exported prior to children messages so that the proper message headers can be set. Failure to do this will result in messages that may not be threaded properly when viewed using a mailreader. Therefore, parent messages should be first in the list.

Specified by:
exportData in interface GatewayExporter
Parameters:
forumMessage - array of messages to export, sorted parents first.
Throws:
GatewayException - if a connection was unable to be established.

stop

public void stop()
          throws GatewayException
Description copied from interface: GatewayExporter
Stop a running export.

Specified by:
stop in interface GatewayExporter
Throws:
GatewayException

getHost

public java.lang.String getHost()
Returns the SMTP host (eg mail.example.com). The host is null by default, but must be set before gateway exports can execute.

Returns:
the SMTP host.

setHost

public void setHost(java.lang.String host)
Sets the SMTP host (eg mail.example.com). The host is null by default, but must be set before gateway exports can execute.

Parameters:
host - the SMTP host.

getPort

public int getPort()
Returns the port number that will be used when connecting to the SMTP server. The default is 25, the standard SMTP port number.

Returns:
the SMTP port number.

setPort

public void setPort(int port)
Sets the port number that will be used when connecting to the SMTP server. The default is 25, the standard SMTP port number.

Parameters:
port - the SMTP port number.

getUsername

public java.lang.String getUsername()
Returns the username that will be used when connecting to the SMTP server. The default is null, or no username.

Returns:
the SMTP username.

setUsername

public void setUsername(java.lang.String username)
Sets the username that will be used when connecting to the SMTP server. The default is null, or no username.

Parameters:
username - the SMTP username.

getPassword

public java.lang.String getPassword()
Returns the password that will be used when connecting to the SMTP server. The default is null, or no password.

Returns:
the SMTP password.

setPassword

public void setPassword(java.lang.String password)
Sets the username that will be used when connecting to the SMTP server. The default is null, or no username.

Parameters:
password - the SMTP password.

isDebugEnabled

public boolean isDebugEnabled()
Returns true if debugging is turned on for the email transport layers. Debug information is written to System.out by the underlying JavaMail provider.

Returns:
true if debugging is turned on.

setDebugEnabled

public void setDebugEnabled(boolean debugEnabled)
Toggles SMTP transport layer debugging on or off. Debug information is written to System.out by the underlying JavaMail provider.

Parameters:
debugEnabled - true if SMTP debugging should be enabled.

isEmailPrefEnabled

public boolean isEmailPrefEnabled()
Returns true if a user's privacy setting on their email address should be obeyed when doing an export.

Returns:
true if a user's privacy settings are respected during exports.

setEmailPrefEnabled

public void setEmailPrefEnabled(boolean enabled)
Toggles whether a user's privacy setting on their email address should be obeyed when doing an export.

Parameters:
enabled - true if a user's privacy settings are respected during exports.

isFromAddressOnly

public boolean isFromAddressOnly()
Returns true if the default from address should be used exclusively when sending email, ignoring the user's preferences. Default is false.

Returns:
true if the default from address should be used exclusively when sending email, ignoring the user's preferences. Default is false.

setFromAddressOnly

public void setFromAddressOnly(boolean enabled)
Toggles whether to exclusively use the default from address when sending email and ignore the users's preferences. Default is false.

Parameters:
enabled - true if the default from address should be used exclusively when sending email, ignoring the user's preferences. False otherwise.

getToAddress

public java.lang.String getToAddress()
Returns the email address that messages will be sent to during exports. If the gateway is for a mailing list, this would be the mailing list address (e.g., your-list@example.com).

Returns:
the email address that will receive exported messages.

setToAddress

public void setToAddress(java.lang.String address)
Sets the email address that messages will be sent to during exports. If the gateway is for a mailing list, this would be the mailing list address (e.g., your-list@example.com).

Parameters:
address - the email address that will receive exported messages.

getDefaultFromAddress

public java.lang.String getDefaultFromAddress()
From email address to send mail from for export. Used in the case of anonymous users or users who hide their information.

Returns:
the current sender.

setDefaultFromAddress

public void setDefaultFromAddress(java.lang.String address)
Set the from email address for message export.

Parameters:
address -

getReplyToAddress

public java.lang.String getReplyToAddress()
Returns the reply to address for export.

Returns:
the reply to address.

setReplyToAddress

public void setReplyToAddress(java.lang.String address)
Set the reply-to email address for message export.

Parameters:
address -

isSSLEnabled

public boolean isSSLEnabled()
Checks to see if this gateway is configured for SSL connections to the SMTP server or not. Unlike most standard SSL connections to the SMTP server are often on the same port as unencrypted connections (port 25).


setSSLEnabled

public void setSSLEnabled(boolean sslEnabled)
Sets whether this gateway is configured for SSL connections to the SMTP server or not.

Parameters:
sslEnabled - true if ssl should be enabled, false otherwise.

getOrganization

public java.lang.String getOrganization()
Retrieves the Organization header for outbound smtp messages. Default is null.

Returns:
the current organization header.

setOrganization

public void setOrganization(java.lang.String organization)
Sets the Organization header for outbound smtp messages.

Parameters:
organization - the string to set the organization header to.

isUpdateMessageIDOnExport

public boolean isUpdateMessageIDOnExport()
Retrieve whether the gateway will update the messageID message property stored in Jive upon export of a message. By default, the messageID is stored in Jive so that the message won't be reexported accidentally.

Note: This setting has no effect unless accompanied by setAllowExportAgain(true).

Returns:
true if the gateway will update Jive with the messageID on export, false otherwise.

setUpdateMessageIDOnExport

public void setUpdateMessageIDOnExport(boolean updateMessageID)
Sets whether the gateway will update the messageID message property stored in Jive upon export of a message. By default, the messageID is stored in Jive so that the message won't be reexported accidentally.

Note: This setting has no effect unless accompanied by setAllowExportAgain(true).

Parameters:
updateMessageID - true if Jive should be updated with the messageID of exported messages, false otherwise.

isAllowExportAgain

public boolean isAllowExportAgain()
Return whether this gateway will allow reexporting of messages or not. Default is false.

Returns:
whether reexporting a message is allowed or not.

setAllowExportAgain

public void setAllowExportAgain(boolean allowExportAgain)
By default this gateway refuses to re-export a message which has previously been exported or imported or which was automatically created for threading purposes by an import gateway.

However this can be overridden so that messages can be re-exported again if absolutely needed. Definite care is needed if you set the property to true.

Please note however that dummy messages will *never* be exported.

Parameters:
allowExportAgain - true if messages should be allowed to be reexported, false otherwise.

isAttachmentsEnabled

public boolean isAttachmentsEnabled()

setAttachmentsEnabled

public void setAttachmentsEnabled(boolean attachmentsEnabled)

getSpecialCharacterSet

public java.lang.String getSpecialCharacterSet()
Returns the special encoding for the email output, or null.

Returns:
the special encoding for the email output, or null.

setSpecialCharacterSet

public void setSpecialCharacterSet(java.lang.String specialCharacterSet)
Sets the special encoding for the forum. This encoding, if not null, will be used as the character encoding for outgoing email messages.

Parameters:
specialCharacterSet - the encoding to send email messages with, or null to use Jive's normal encoding.

getLastExport

public java.util.Date getLastExport()
Description copied from interface: GatewayExporter
Last date this exporter completed

Specified by:
getLastExport in interface GatewayExporter
Returns:
the last date this exporter completed

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.