Contents

Objective

To demonstrate the capability of an application using SMTP (Simple Mail Transfer Protocol) component and POP3 component to send and receive mails to and from Gmail servers respectively.

Prerequisites

  • Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
  • Login to eStudio application
  • Understand the basic menus and perspectives (panels) in eStudio application

Scenario

Use SMTP adapter to send mail to the required mail address by sending an XML message containing the details about the mail from Feeder component.
Use POP3 adapter to fetch the mail from the configured mail address by sending an XML message using another Feeder component.

Components used

Setting up the Example

Configuring SMTP component

To configure SMTP component to send mail to Gmail account, perform the following actions:

  1. Create an Event Process with name 'Gmail_Example'.
  2. Drag the SMTP adapter from the Bridges category in the Micro Service Palette to the Fiorano Orchestrator.


    Figure 1: Adding SMTP component to Gmail_Example Orchestrator
     
  3. Double-click the SMTP adapter to open its Component Property Sheet (CPS).
  4. In the Managed Connection Factory dialog box, click the SMTP Server section to expand the options.


    Figure 2: SMTP component CPS
     
  5. Under SMTP Server section, retain Protocol value 'SMTP' and click Connection Configuration Ellipsis button.


    Figure 3: Navigating to SMTP Connection Configuration
     
  6. In the SmtpConnectionConfiguration dialog box, provide the following details under Component Configuration section to configure SMTP component to connect to the Gmail server:
    1. MailServer IP/Name: smtp.gmail.com
    2. MailServer Port: 465


      Figure 4: Providing Mail Server details
       
    3. In the Additional Properties section, click Add button and provide the following values for Name and Value respectively:
      • mail.smtp.starttls.enable=true
      • mail.smtp.auth=true
      • mail.smtp.ssl.enable=true
      • mail.smtp.ssl.protocols=TLSv1.2


        Figure 5: Adding Additional Properties required for Gmail server

        Icon

        Additional properties are optional which varies according to the mail server. Values provided above are pertaining to Gmail server.

  7. Press OK to close the SmtpConnectionConfiguration dialog box and save the connection configuration.
  8. Click the Test button present in the bottom-right part of the Managed Connection Factory panel to ensure successful connection. Click Close to close the Test Connection Configuration dialog box displaying successful connection message.


    Figure 6: Testing SMTP Connection status
     
  9. Under Authentication Details section, click AuthenticationConfiguration Ellipsis button.
  10. In the AuthenticationConfiguration dialog box, select the AuthenticationRequired check box to enter the credentials. In the Username text field that appears, enter the user name in the format <Name>@gmail.com 
  11. Generate app password from https://accounts.google.com/IssuedAuthSubTokens?hide_authsub=1 for 'Mail'
  12. Choose the desired device in App passwords section at Google Account > Security > Signing in to Google.
  13. Use the generated password in the Password text field that appears.


    Figure 7: Providing Authentication details
     
  14. Click OK to close AuthenticationConfiguration dialog box and click Next in Managed Connection Factory dialog box.
  15. In the InteractionConfigurations panel, provide the following values under Sender Information section:
    1. Display Name of the Sender: Name of the sender to be displayed in the mail.
    2. Email ID of the Sender: Valid mail ID with respect to the server details provided in the Managed Connection Factory Panel.

      Icon

      The above values get populated in the <From> element of input message.


      Figure 8: Providing Sender information

  16. Click Finish to save the configuration and close the CPS

After the configuration, an XSD schema gets set in the input port of the component, which is the schema that any input message should follow to get the desired output.

Configuring the POP3 component

To configure POP3 component to receive mails from an account in Gmail server, perform the following actions in the Gmail_Example event process:

  1. Drag the POP3 adapter from the Bridges category in the ServicePalette to the Fiorano orchestrator.
  2. Double-click the POP3 component to open its CPS.
  3. In the Managed Connection Factory dialog box, retain Protocol value 'POP3' and click Connection Configuration Ellipsis button.


    Figure 9: Navigating to POP3 Connection Configuration
     
  4. In the Pop3ConnectionConfiguration dialog box, provide the following details under Component Configuration section to configure the POP3component to connect to the Gmail server:
    1. MailServerURL: pop.gmail.com
    2. MailServer Port: 99

      Figure 10: Providing Mail Server details

  5. In the Additional Properties section, click Add button and provide the following values for Name and Value respectively:
    1. mail.pop3.starttls.enable=true

    2. mail.pop3.auth=true

    3. mail.pop3.ssl.enable=true

    4. mail.pop3.socketFactory.fallback=false

    5. mail.pop3.socketFactory.port=995

    6. mail.pop3.ssl.protocols=TLSv1.2

    Icon

    Additional properties are optional which varies according to the mail server. Values provided above are pertaining to Gmail server.



    Figure 11: Adding Additional Properties required for Gmail server
     

  6. Press OK to close the SmtpConnectionConfiguration dialog box and save the connection configuration.
  7. Click the Test button present in the bottom-right part of the Managed Connection Factory panel to ensure successful connection. Click Close to close the Test Connection Configuration dialog box displaying successful connection message.


    Figure 12: Testing POP3 Connection status
     
  8. In the Managed Connection Factory panel, click Authentication Configuration Ellipsis button.
  9. In the AuthenticationConfiguration dialog box, select the Authentication Required check box to enter the credentials. In the Username text fields that appear, enter the user name in the format <Name>@gmail.com
  10. Generate app password from https://accounts.google.com/IssuedAuthSubTokens?hide_authsub=1 for 'Mail'
  11. Choose the desired device in App passwords section at Google Account > Security > Signing in to Google.
  12. Use the generated password in the Password text field that appear.


    Figure 13: Providing Authentication details
     
  13. Click OK to close AuthenticationConfiguration dialog box and click Next in Managed Connection Factory dialog box.
  14. In the Interaction Configurations panel, select Operation Name 'recvMail' to retrieve the details in the mail and pass to output port, and click Next.


    Figure 14: Selecting Operation Name 'recvMail' to retrieve the Mail details
     
  15. In the Scheduler Configurations panel. Select Enable Scheduling checkbox to configure scheduling with the default repeat interval of 10 seconds to start checking for mail every 10 seconds after launching the EP.


    Figure 15: Enabling Scheduling
     
  16. Go to Input Message tab, select Use Specified Input checkbox and click the Generate Sample button. In the sample generated, change the MessageCount value to '1' to specify limit the number of mails that needs to be read from the mail server to one.


    Figure 16: Changing message count to '1' in the sample generated
     
  17. Click Finish to save the configuration and close the CPS.

The POP3 component gets configured to receive mails from the Gmail server. After the configuration, an XSD schema gets set in the input port of the adapter, which is the schema that any input message should follow to get the desired output.

Composing the Event Process

To send an input conforming to the XSD Schema set in the input port of the SMTP/POP3 adapter, use the Feeder component and to see the output from the SMTP/POP3 component, use the Display adapter.

Add the above components in the Gmail_Example event process and connect them as mentioned below:

  1. Add a Feeder component and two Display components from the Util category in the ServicePalette to Fiorano Orchestrator.


    Figure 17: Adding Feeder and Display components to Gmail_Example event process
     
  2. Rename the Display components in the following manner to distinguish between the ones connected to SMTP and POP3:
    1. 'Display1' to 'Display_SMTP'
    2. 'Display2' to 'Display_POP3'
    To rename, click the respective component, press F2, change the name and click OK. Alternatively, change the Name property under General tab in Properties, and press ENTER.
  3. Connect the components in the following manner:
    1. Feeder component output port to SMTP input port
    2. SMTP component output port to Display_SMTP input port
    3. POP3 component output port to Display_POP3 input port


      Figure 18: Connecting Feeder and Display with their changed names
       

Configuring Feeder component

In the Gmail_Example event process, perform the following actions:

  1. Double-click the Feeder component to open its CPS.
  2. In the Message Type Configuration page, retain Output Message Format option as 'XML' and click the Connected Port Schemas button.
  3. In the Connected ports dialog box, select IN_PORT to enable connection between output port of Feeder and input port of SMTP component. Click OK to load that port schema and then click Next.


    Figure 19: Connecting Feeder input port schema to SMTP output port
     
  4. As the Schema appears in the Schema editor, click Next.


    Figure 20: XSD Schema editor with the schema populated
     
  5. In the Message Details Configuration page, click the Generate Sample button to load sample input.
  6. Under No.of Repeatable elements to be generated section in the XSD Sample Generation Dialog window, replace max value '3' with '1' so that only one output is generated, and click OK.


    Figure 21: Reducing the number of elements to be generated to '1'
     
  7. In the sample generated, provide content in Subject element and TextBody element ("TestMail" and "This is a Test Mail" provided respectively in this example).

     
    Figure 22: Sample data with the edited content

    Icon
    1. Recipient and Sender mail IDs can be edited in To and From elements. Delete these tags from the editor to reflect (in Feeder window after running Gmail_Example event process) the details entered in SMTP and POP3 configuration.
    2. Provide the elements: CC, BCC, ReplyTo and ReturnReceipt if required. Delete these tags if not required because specific email addresses need to be present for these elements.
  8. Click Finish to complete the Feeder configuration.

Running the Example

To run the example, perform the following actions in the Orchestrator:

  1. Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
  2. Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Three windows for Feeder, Display_SMTP, and Display_POP3 components get opened.
  3. In the Feeder window, the message configured in its CPS appears. Click Send.


    Figure 23: Sending data using Feeder
     
  4. Display_SMTP window shows the acknowledgement of the email sent.


    Figure 24: Acknowledgement of the mail sent appearing in Display_SMTP
     
  5. Login to the recipient Gmail account and verify the receipt of email.


    Figure 23: Mail received in the recipient Inbox displaying the Subject and content
     
  6. Display_POP3 shows the entire message details in XML format retrieved from the Gmail server.
    Every 10 seconds (as configured in the POP3 Scheduler Configuration) after launching the EP, POP3 component looks for any new message to be retrieved.


    Figure 25: Mail content in XML format displayed in Display_POP3 

Reference

Adaptavist ThemeBuilder EngineAtlassian Confluence