SAS 9.1.3 Integration Technologies » Developer's Guide


Publish Package Interface
Publish/Retrieve Encoding Behavior
Publishing Packages
INSERT_CATALOG
INSERT_DATASET
INSERT_FDB
INSERT_FILE
INSERT_HTML
INSERT_MDDB
INSERT_PACKAGE
INSERT_REF
INSERT_SQLVIEW
INSERT_VIEWER
PACKAGE_BEGIN
PACKAGE_END
PACKAGE_PUBLISH
LDAP Channel Store Syntax
SAS Metadata Repository Channel Store Syntax
Retrieving Packages
COMPANION_NEXT
ENTRY_FIRST
ENTRY_NEXT
PACKAGE_DESTROY
PACKAGE_FIRST
PACKAGE_NEXT
PACKAGE_TERM
RETRIEVE_CATALOG
RETRIEVE_DATASET
RETRIEVE_FDB
RETRIEVE_FILE
RETRIEVE_HTML
RETRIEVE_MDDB
RETRIEVE_NESTED
RETRIEVE_PACKAGE
RETRIEVE_REF
RETRIEVE_SQLVIEW
RETRIEVE_VIEWER
Filtering Packages
Publishing Examples
Publishing in the Data Step
Publishing in a Macro
Publishing with FTP
Publishing Framework

Publish to E-mail

Publishes a package using the e-mail transport.

Syntax

CALL PACKAGE_PUBLISH(packageId, publishType, rc, properties, <propValue1, ...propValueN> , address1<, ...addressN>);

packageID
Numeric, input.
Identifies the package that is to be published.

publishType
Character, input.
Indicates how to publish the package. To publish the package using the e-mail transport, specify TO_EMAIL.

rc
Numeric, output.
Specifies a return code.

properties
Character, input.
Identifies a comma-separated list of optional property names. Specify any of the following property names, or specify '' to indicate that no properties are to be applied:

propValue1, ...propValueN
Specifies a value for each specified property name. The order of the property values must match the order of the property names in the properties parameter.

address1 <, ...addressN>
Character, input.
Specifies one or more e-mail addresses to use when publishing the package.

Details

Default Behavior

When publishing to e-mail, the e-mail message is sent in plain text format by default. Only inserted reference entries are published to e-mail. For details about inserting reference entries, see the INSERT_REF CALL routine.

The package description field precedes the reference value in the e-mail message. All other entries that are inserted into the package are ignored.

To override the default behavior, you can specify the ARCHIVE_PATH, COLLECTION_URL, PARENT_URL, TEXT_VIEWER_NAME, or VIEWER_NAME properties.

Note: If the mailer is not running in a Windows NT operating environment, you will be prompted for the mail profile to use when you send the e-mail message. To avoid being prompted, specify the EMAILID and EMAILPW options at SAS invocation. For example:

   sas -EMAILID "Microsoft Outlook"

Archive Path Properties

If you specify the ARCHIVE_PATH property, an archive is created and published as an e-mail attachment. All entries that are inserted into the package are published as an archive. If you specify a value for ARCHIVE_PATH, the created archive is stored at the designated location. To create a temporary archive that is deleted after the package is published, specify an ARCHIVE_PATH value of "" or "tempfile".

If you specify ARCHIVE_PATH as an LDAP URL, an FTP URL, or an HTTP URL, see How to Specify an ARCHIVE_PATH for details about archive properties.

Note: In order to create an archive under the z/OS operating environment, the z/OS environment must support UNIX System Services directories.

If you specify the PROCESS_VIEWER property (with either the VIEWER_NAME or TEXT_VIEWER_NAME property) along with the ARCHIVE_PATH property, the archive is created but is not sent as an attachment in e-mail. Instead, viewer processing occurs and the rendered view is sent in e-mail.

For more information about the application of viewer properties, see Viewer Processing.

When publishing to an archive with the e-mail transport, you can specify the following archive properties: ARCHIVE_NAME, ARCHIVE_PATH, FTP_PASSWORD, FTP_USER, HTTP_PASSWORD, HTTP_PROXY_URL, HTTP_USER, LDAP_BINDDN, or LDAP_BINDPW.

Viewer Properties

If you specify the VIEWER_NAME or TEXT_VIEWER_NAME property, the viewer is used to create the e-mail message and to apply substitutions. VIEWER_NAME renders the view in HTML format. TEXT_VIEWER_NAME renders the view in text format. Only the package information that is rendered by the viewer is published.

If you specify the PROCESS_VIEWER property (with either the VIEWER_NAME or TEXT_VIEWER_NAME property) along with the ARCHIVE_PATH property, the archive is created but is not sent as an attachment in e-mail. Instead, viewer processing occurs and the rendered view is sent in e-mail.

WebDAV Properties

If you specify the COLLECTION_URL property, the package is published to the specified URL on a WebDAV-compliant Web server. An example of a collection URL is http://www.host.com/AlphaliteAirways/revenue/quarter1. The collection is named quarter1. The e-mail message that is sent to subscribers will contain a reference to the URL that is specified in the COLLECTION_URL property.

The PARENT_URL property is similar to the COLLECTION_URL property except that it specifies the location under which the new WebDAV collection is to be placed. The PUBLISH_PACKAGE CALL routine generates a unique name for the new collection. The unique name is limited to eight characters, with the first character as an s. An example of a parent URL directory location is http://www.host.com/AlphaliteAirways/revenue. An example of a collection name that is automatically generated might be s9811239. The e-mail message contains a reference to the collection, which is URL that you specified in the PARENT_URL property.

The specifications of COLLECTION_URL and PARENT_URL are mutually exclusive.

When publishing to a WebDAV-compliant server with the e-mail transport, you can specify the following WebDAV properties: HTTP_PASSWORD, HTTP_PROXY_URL, HTTP_USER, IF_EXISTS, TARGET_VIEW_MIMETYPE, TARGET_VIEW_NAME, and VIEWER_NAME (or TEXT_VIEWER_NAME).

WebDAV publishing uses the following file extensions for each item type:

Item Type File Extension
CATALOG .sac
DATA .sad
FDB .saf
MDDB .sam
VIEW .sav

Examples

Example 1

The following example publishes a package to three e-mail addresses. Because no properties are specified, the e-mail message will contain only inserted references and will be published in plain text format.
   pubType = "TO_EMAIL";
   properties='';
   CALL PACKAGE_PUBLISH(packageId, pubType, rc, properties,
      "user1@alphaliteairways.com", "John Smith",
      "jsmith@alphaliteairways.com");

Example 2

The following example publishes a package to one e-mail address and designates text for the subject line of the message:
   pubType = "TO_EMAIL";
   subject = "Nightly Builds Update";
   properties="SUBJECT";
   Addr = "admins-l@alphaliteair03.vm.com";
   CALL PACKAGE_PUBLISH(packageId, pubType, 
      rc, properties, subject, Addr);

Example 3

The following example publishes a package to two e-mail addresses and designates the viewer to be used when formatting the e-mail message. The e-mail message will contain only content that can be rendered in a view. The rendered view is deleted after it is published.

In order to save the rendered view explicitly, you can specify the APPLIED_VIEWER_NAME property and a file name value.

   pubType = "TO_EMAIL";
   properties="SUBJECT, VIEWER_NAME";
   subject = "Nightly Build Updates";
   viewer = "filename:template.html";
   Addr = "admins-l@alphaliteair03.vm.com";
   CALL PACKAGE_PUBLISH(packageId, pubType, 
      rc, properties, subject, viewer, 
      "buildmonitor@alphaliteairways.com", Addr);

Example 4

The following example uses the ARCHIVE_PATH property to publish an archive as an e-mail attachment. All entries in the package are contained within the archive.
   pubType = "TO_EMAIL";
   properties="ARCHIVE_PATH";
   apath = "/u/users1";
   Addr = "admins-l@alphaliteair05";
   CALL PACKAGE_PUBLISH(packageId, pubType, 
      rc, properties, apath, Addr);

Example 5

The following example uses the e-mail transport to publish a collection URL on a WebDAV-compliant server. The HTTP user ID and password enable the publisher to bind to the secured HTTP server. All e-mail recipients who are members of the mail list receive the e-mail announcement that the best rates are accessible at the specified URL.

   pubType = "TO_EMAIL";
   properties="COLLECTION_URL, SUBJECT", 
      "HTTP_USER", "HTTP_PASSWORD";
   collurl="http://www.alphaliteairways/fares/discount";
   subj="Announcing Best Rates Yet";
   http_user="vicdamone";
   http_password="myway";
   Addr = "admins-l@alphaliteair05";
   CALL PACKAGE_PUBLISH(packageId, pubType, rc, properties, 
      collurl, subj, http_user, http_password, Addr);

Example 6

The following example specifies e-mail addresses that are stored in a variable in a password-protected SAS data set.

   pubType = "TO_EMAIL";
   properties = "SUBJECT, ADDRESS_DATASET_LIBNAME, 
      ADDRESS_DATASET_MEMNAME, ADDRESSLIST_VARIABLE_NAME, 
      DATASET_OPTIONS";
   subject = "Get out and Vote!";
   lib = "voterreg";
   mem = "northeast";
   var = "emailaddr";
   opt = "pw='born2run'";
   CALL PACKAGE_PUBLISH(packageId, pubType, rc, 
      properties, subject, lib, mem, var, opt);