Page History
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
|
To receive and delete mails from a POP3 -Serverserver, you can use the POP3 - Adapter. The POP3 parameters can be set provided statically in the component diagram or dynamically via action script.
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
...
Receiving Mails (Static Usage)
In order to receive a mail from the a POP3 -Serverserver, the use action getMessage is applied in with the POP3 - Adapter. In the With static usage of the adapter, the POP3 -Parameters parameters are provided from in the configuration and deployment component diagram by via the alias tagged-value that is used on the POP3-Adapteradapter action.
As illustrated by the Figure Static Usage of the POP3 Adapter Action get next message in the activity diagram above has an input parameter deleteOnServer. The This parameter is of type Boolean and indicates , whether the message is to be deleted after it has been fetched by the POP3 adapter. If the parameter is set to true, a DELE
command is send to the POP3 -Server server and the message will be flagged as to be deletedeleted.
When the whole SOAP request (i.e. not only the activity where the POP3 adapter is modelledmodeled) has come to an end without an exception, the POP3 session will be closed with a QUIT
command, and the POP3 -Server server deletes the messages definitelyfinally.
But if If there is an exception during the whole processing, the POP3 session will be closed with a RSET
command, and all marks are removed on from the messages, this . This means that no message will be deleted.
Noteinfo | ||
---|---|---|
| ||
The parameter Parameter deleteOnServer can not be specified in the component diagram, even . Even in the case of a static usage, it has to be modelled modeled as a dynamic parameter. |
The POP3 adapter does not retrieve all messages at once - the output of the adapter is a single message object. If there is more than one message in your server's inbox and you want to fetch all of them, you will have to do it one after another in a separate getMessage call. The POP3 adapter does not retrieve all messages at one time and store them in an array. As illustrated in the example, the output of the adapter is a single message object. To get another one by one by separate getMessage calls. To get a next message from the mail server, you have to draw the control flow back to the POP3 adapter and start another getMessage call.
The output parameter is messageOutput of a POP3 Adapter call is parameter message, an object of type POP3Message. The whole content of the message is stored as a Blob in the attribute content (refer in the containment tree to Data - Base Components - Add Ons - POP3 - POP3Messagesee POP3 Adapter Parameter Types). Hence, the content must be decoded and separated into parts to make it readable. This is done by the a MIMEConverter in the sub activity extractMessage (for more details refer to the chapter MIME Converter).
Figure: Decode MIME-Parts
...
Sometimes it is necessary do to access the POP3 -Headers headers as in action build out message. The attribute in the picture above. Attribute pop3Header of class POP3Message holds the raw POP3 headers.
...
Receiving Mails (Dynamic Usage)
Unlike In the dynamic case - unlike the static usage of the POP3 adapter, all input parameters of the adapter are passed on to it during runtime in the dynamic case at runtime (as illustrated shown in the figure above figure).
Delete and Commit/Rollback Received Mails
As already mentioned beforeIf the deleteOnServer flag has been set, the messages on the POP3 -Server server are deleted after the SOAP - request (transaction) has ended without an exception if the deleteOnServer flag is set. But sometimes, e.g. when processing a large amount of messages or in other circumstances , it might be necessary to commit or rollback the deletion of the message on the POP3 -Server server manually.
In order to do this, use the POP3 - Adapter with the action commit respectively rollback. As Only input you need is the sessionId is used only, which was has been received earlier with the getMessage action before.