Designer > System Services > Email Service
  

Email Service

Process Server supports an email service. This means you can create a process that sends email messages to a list of recipients via an invoke activity. Many types of processes can benefit from an email delivery activity, including use an Alert Service.
Any BPEL process that implements email-based activities imports the WSDL provided with the ProcessServer. The name of the WSDL is email.wsdl, and in the Participants view wizards, it is a System Service named send email. The WSDL contains a send operation that can be used in an invoke activity as follows:
<invoke
inputVariable="emailMessage"
operation="send"
outputVariable="resultMessage"
partnerLink="emailProvider"/>
To create a BPEL process that sends an email:
  1. 1. In the Project Explorer, create a new orchestration project.
  2. 2. Select File > New > BPEL Process.
  3. 3. Name the process and click Finish.
  4. 4. In the Participants view, create a new Partner Service Provider.
  5. 5. Select System Services.
  6. 6. Select Email.
  7. 7. From Participants view, drag the send operation to the canvas to create an invoke activity. This activity sends the email message to people in your identity service enabled on the Process Server.
  8. 8. Add additional programming logic. For example:
    1. a. Add a receive activity that receives the input to be associated with the email.
    2. b. Use the input tab of the invoke to assign data to the variable. See the examples below.
  9. 9. Use the send operation's fault message to catch communication errors with your email service.
Example to initialize the emailMessage variable:
  1. 1. In the Input tab of the invoke, select XPaths as the Assignment Type.
  2. 2. Select Add.
  3. 3. In the E/L panel, select Literal.
  4. 4. In the From column, select the dialog button and generate literal contents. Process Developer automatically finds the correct schema for the selected single-part element-based variable and generates a literal template for you as shown:
  5. Generated Template
    <aem:emailMessage xmlns:aem="http://schemas.active-endpoints.com/email/2007/01/email.xsd">
    <aem:from>string</aem:from>
    <aem:replyTo>string</aem:replyTo>
    <aem:to>string</aem:to>
    <aem:cc>string</aem:cc>
    <aem:bcc>string</aem:bcc>
    <aem:subject>string</aem:subject>
    <aem:body mimeType="string"></aem:body>
    </aem:emailMessage>
    To avoid errors, be sure to set the body mimeType to a valid type such as text/plain. See the example in Step 5.
  6. 5. Use one of the following tips to populate the emailMessage elements with the appropriate strings:
Example
<ns:emailMessage
xmlns:ns="http://schemas.active-endpoints.com/email/2007/01/email.xsd">
<ns:from>Dave Verd &lt; DVerd@mycompany.com &gt;</ns:from>
<ns:replyTo>sender@mycompany.org</ns:replyTo>
<ns:to>{$quoteRequest/quote:contact/quote:name()}</ns:to>
<ns:subject>{ $quoteRequest/quote:contact/quote:description}</ns:subject>
<ns:body mimeType="plain/text">Message goes here.</ns:body>
</ns:emailMessage>
Deploying a Process as an Email Service
You can deploy your process and make it available as a standard document literal service for the My Role partner link. Note that in the BPR, there are no WSDL or XSD. They are already deployed and available on the server.
If your email list contains an invalid address, the process logs an error. Check the Server Log in the Process Console to view email errors.