See: Description
Interface | Description |
---|---|
IAttachmentChannel | |
IAttachmentRecipient | |
IChannel |
A channel is the abstraction of an transport mechanism for sending messages
to recipients.
|
IChannelList |
A list of
IChannel s. |
IChannelListIterator |
Iterator for a
IChannelList . |
IRecipient |
Recipients are objects, where messages can be sent to via a channel.
|
IRecipientList |
A list of
IRecipient s. |
IRecipientListIterator |
Iterator for a
IRecipientList . |
Class | Description |
---|---|
AbstractChannel |
Base class for
IChannel -implementations. |
ChannelFactory |
A factory to retrieve
IChannel s. |
RecipientFactory |
A factory to retrieve
IRecipient s. |
Exception | Description |
---|---|
PartialSendException |
The
PartialSendException indicates, that some recipients
couldn't be addressed. |
IChannel
s are mechanisms, via which messages are sent from a sender to a
receiver. IChannel
s can be obtained through the ChannelFactory
.
IRecipient
s are single persons or distribution lists with addresses for the several
IChannel
s. The format of these addresses are specific to the different channels.
IRecipient
s can be obtained through the RecipientFactory
.
Each channel must be configured in order to be accessible through the ChannelFactory with the following parameter:
Property | Required | Description |
class | yes | 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:
Property | Required | Description |
server | yes | The mail server that is used to send eMail notifications to. |
user | no | The user used to log into the server. Default: no user. |
password | no | The password of the user. Default: no password |
type | no | Specifies, which email protocol is used, either SMTP or IMAP. Default: SMTP. |
The follwing parameters are valid for an SmsChannel:
Property | Required | Description |
server | yes | The mail server that is used to send the SMS-eMail and which passes the eMail to the SMS-Gateway. |
user | no | The user used to log into the server, default: no user. |
password | no | The password of the user, default: no password |
gateway | no | The eMail address of the SMS gateway (see field). Default: (empty String) |
prefix | no | SmsChannel: A prefix to use for the eMail address or eMail subject (see field). Default: (empty String) |
field | no |
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. |
format | no | 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
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:
To retrieve an eMail channel, the code could look like this: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");
If the addresses are already known in the channel's format, no recipient objects are needed:IChannel channel = ChannelFactory.getInstance().getFirstChannelForType(ChannelFactory.EMAIL);
channel.sendTo("recipient.someone@somewhere", "sender.myself@sap", "messagetitle", "hello world", "text/plain");
Copyright 2018 SAP AG Complete Copyright Notice