Skip navigation links
SAP NetWeaver 7.50 SP 13 KMC

Package com.sapportals.wcm.util.channels

Contains interfaces and classes for sending messages to recipients.

See: Description

Package com.sapportals.wcm.util.channels Description

Contains interfaces and classes for sending messages to recipients.

Package Specification

Purpose

IChannels are mechanisms, via which messages are sent from a sender to a receiver. IChannels can be obtained through the ChannelFactory.
IRecipients are single persons or distribution lists with addresses for the several IChannels. The format of these addresses are specific to the different channels. IRecipients can be obtained through the RecipientFactory.

Installation

Each channel must be configured in order to be accessible through the ChannelFactory with the following parameter:

PropertyRequiredDescription
classyes The class that is used for the specified channel, like com.sapportals.wcm.util.channels.wcm.EmailChannel for EMAIL.

The different channel implementations require additional parameters.

The follwing parameters are valid  for an EmailChannel:

PropertyRequiredDescription
serveryes The mail server that is used to send eMail notifications to.
userno The user used to log into the server. Default: no user.
passwordno The password of the user. Default: no password
typeno Specifies, which email protocol is used, either SMTP or IMAP. Default: SMTP.

The follwing parameters are valid  for an SmsChannel:

PropertyRequiredDescription
serveryes The mail server that is used to send the SMS-eMail and which passes the eMail to the SMS-Gateway.
userno The user used to log into the server, default: no user.
passwordno The password of the user, default: no password
gatewayno The eMail address of the SMS gateway (see field). Default: (empty String)
prefixno SmsChannel: A prefix to use for the eMail address or eMail subject (see field). Default: (empty String) 
fieldno SmsChannel: Defines the way, the eMail for the eMail-SMS-gateway is build. If 'to' is specified, the eMail-to-field will be constructed from prefix, actual address and gateway. If 'subject' is specified, the eMail-to-field will be constructed from gateway, the eMail-subject-field will be constructed from prefix and actual address.
Example: if prefix is set to 'Number=', gateway is set to 'sms@smtp.server' and the actual address for the person to send the SMS to is set to '++49123456789' the result would be:
For subject:
    to = sms@smtp.server
    subject = Number=++49123456789
For to:
    to = Number=++49123456789sms@smtp.server
    subject = 
Default: subject.
formatno Define the message MIME format (overwrite format from XSL). Default: (MIME format from XSL, usualy text/plain)

The following is a sample configuration for an EmailChannel:

class = com.sapportals.wcm.util.channels.wcm.EmailChannel
server = mailserver.sap.com
user = user
passwd = passwd
type = SMTP

The following is a sample configuration for an EmailChannel:

class = com.sapportals.wcm.util.channels.wcm.SmsChannel
server = mailserver.sap.com
gateway = sms@sap.com
user = user
passwd = passwd
prefix = number=
field = subject
format = text/plain

 

Implementation notes

Sending MimeMessages or text via IChannels to IRecipients.

To send a plain text (for example hello world) from the user myself to the recipient someone via his/her perferred channel, the following code shows how to do that:

IRecipient myself = RecipientFactory.getInstance().getRecipient("myself");
IRecipient someone = RecipientFactory.getInstance().getRecipient("someone");
IChannel channel = recipient.getDefaultChannel();
recipient.sendTo(channel, channel.getRecipientAddress(myself), "messagetitle", "hello world", "text/plain");
To retrieve an eMail channel, the code could look like this:
IChannel channel = ChannelFactory.getInstance().getFirstChannelForType(ChannelFactory.EMAIL);
If the addresses are already known in the channel's format, no recipient objects are needed:
channel.sendTo("recipient.someone@somewhere", "sender.myself@sap", "messagetitle", "hello world", "text/plain");

Issues

Related Documentation

Skip navigation links
SAP NetWeaver 7.50 SP 13 KMC

Copyright 2018 SAP AG Complete Copyright Notice