Custom Transport - Custom Email Service

This article is intended for "onPremise" deployments of Forms Experience Builder (FEB).

Author: Christopher Dawes

v1.0 - Created Feb 2016

 TestEmailService_860.nitro_s

SampleEmailService_template.xml

SampleEmailService_Outlook.xml

EmailServiceTransport_862.jar

This transport provides a more feature rich email solution.  With this transport your FEB application can send an email where you can define the sender, to, cc, bcc, subject, and email body.

I have created two service descriptions that use this custom transport, one sends an email through Microsoft's Outlook web mail and the other through IBM's email relay (I have removed the server name for security purposes).

The purpose of this article is to not only provide the custom extension and examples of how to use it but to also to provide extra detail on how you could create custom solutions like this to further enhance your FEB deployment.


Transport  Input Parameters

Parameter NameDescription
to The user to add to the email TO field.
cc The user to add to the email CC field.
bcc The user to add to the email BCC field.
toList The list of users to add to the email TO field.
ccList The list of users to add to the email CC field.
bccList The list of users to add to the email BCC field.
host The host name of the email server.
port The port to use to connect to the email server.
forceSSL Forces the email to be sent using SSL.  Valid values are "true" or "false", default is "false".
sender The email address to use for the sender of the email.
subject The text to send as the email subject.
body The content to send in the email.
emailFormat Format can be "text" or "html", default is "text".
user The user id to use for the user sending the email.
password The password for the user specified.


Transport Output Parameters

Parameter NameDescription
errMessageIf the service fails the reason for the failure is available from this parameter.


Design Considerations

The reason that FEB as of 8.6.2) does not allow a user to redefine the sender of an email is because it can pose a security risk.  Depending on how the email server is configured a user could potentially send an email as someone else.  This custom transport passes the control from the FEB server to the application designer.  If you are going to use this service (or one like it) then you need to make sure that your form designers understand the concerns associated with it.


In most cases the email server that you will be using will be the same one that is configured with FEB and therefore when designing an application that uses this service the Sender should be linked to the Current User attribute (if the login attribute is set to mail).  If the login attribute for FEB is set to anything other than mail then you will have to perform a service call to retrieve the email address of the current user.  It is not recommended to link the Sender to a field where the form user can specify anything they want as this would result in an email being sent as the user specified which may not be the same user that is using the form.


Installation Instructions

1. Download the EmailServiceTransport.jar file.

2. Add the jar to the extensions directory for your FEB deployment.

3. Download the service description files and add them to your ServiceCatalog/1 directory. Modify the files as appropriate, for example setting the email host and port.

4. Download the sample application (nitro_s).

5. Log in to Forms Experience Builder and import the sample application.

6. Launch the application, fill in the fields, click the Send Email button and verify that you receive an email.


How does this extension work?

The transport uses Java Mail to send an email with all the parameters passed through the service description.


Troubleshooting

To enable debug logging for this custom extension add the trace string "com.ibm.support.examples=finest" to your WebSphere Server where FEB is deployed.  The logs will appear in the trace.log within the server logs directory where FEB is deployed.


If you encounter any issues or have questions please feel free to comment.