Package com.crystaldecisions.sdk.plugin.destination.smtp

This package provides an interface through which the destination options for email can be specified.

See:
          Description

Interface Summary
IAttachment The IAttachment interface provides information for the attachment in the collection, including the attachment's name and mime type.
IAttachments The IAttachments collection allows you to add an object as an attachment to the email destination.
ISMTP This interface extends the IInfoObject and the IDestinationPlugin interfaces.
ISMTPOptions The ISMTPOptions interface allows you to set the global or schedule options to an SMTP email address.
ISMTPOptions.CeSMTPAuthentication Specifies the authentication type to use against the SMTP server.
 

Package com.crystaldecisions.sdk.plugin.destination.smtp Description

This package provides an interface through which the destination options for email can be specified. Two types of options can be set for each destination: global and scheduling. Global options are the default settings for a particular Job Server. Scheduling options are the default settings for the destination plugin and can be copied to a report. When the report is run, the global and scheduling destination options are compared; if the options conflict then the scheduling options override the global options.

Retrieving and setting global and schedule destination options

Both the global and schedule options are set through the corresponding object: the IDiskUnmanagedOptions object, IFtpOptions object, or ISMTPOptions object. Set the global options by using the getPluginInterface() method of the IJobServerDestination object to retrieve the destination plugin. Set the schedule options by directly querying the APS InfoStore for the destination plugin. The query returns the plugin's default object, through which you can access the destination options object.

Note: Enable the destination with IJobServerDestination before a job for that destination is run.

Example

The following example retrieves the SMTP plugin:

IInfoObjects serverObjs = iStore.query( "SELECT SI_NAME, SI_SERVER_KIND FROM CI_SYSTEMOBJS WHERE 
        SI_PROGID='CrystalEnterprise.Server' AND SI_SERVER_KIND='jobserver'");

for (int i = 0; i < serverObjs.size(); i++)
{
        IInfoObject obj = (IInfoObject) serverObjs.get(i);
        IServer serverObj = (IServer) obj;
        IJobServerAdmin jobServer = (IJobServerAdmin) serverObj.getServerAdmin();
        IJobServerDestination[] jobServerDests = jobServer.getDestinations( iStore );
        
        for ( int j = 0; j < jobServerDests.length; j++ )
        {
                IJobServerDestination jobServerDest = jobServerDests[ j ];

                if ( jobServerDest.getName().equals( "CrystalEnterprise.Smtp" ) )
                {                       
                        ISMTPOptions smtpOptions = (ISMTPOptions ) jobServerDest.getPluginInterface();
                }
        }
}

The query method returns a collection of InfoObjects, which in this case are Server plugin objects. Like other InfoObjects, these objects are uniquely represented by their ID property. For each object in the collection,you can access general InfoObject properties, such as the SI_NAME property, SI_DESCRIPTION property, and SI_ID property.

The process for retrieving a destination plugin is as follows:

  1. Query the IInfoStore object for the job server objects.
  2. For each job server object, get the job server admin.
  3. Using the job server admin, retrieve the job server destinations. The destinations will be returned as an array.
  4. For each item in the array, check whether the destination has the ProgId "CrystalEnterprise.Smtp".
  5. If the destination is the SMTP destination, retrieve the plugin interface.
  6. From the plugin interface the ISMTPOptions object can be retrieved. This object allows you to modify the properties of the ftp destination.