Example 8: Using the SMTP Target Connector

This section provides an example of how to use the Simple Mail Transfer Protocol (SMTP) target connector to send an email message using an SMTP server.

For this example, you must have an active SMTP server as well as an active email account to receive the message.

To send an email message to an SMTP server using the SMTP target connector:

  1. In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:

    &msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR);
    
    &xmldata = "<?xml version='1.0'?><ConnectorTest/>";
    
    /* create an XmlDoc */
    &xmlDoc = CreateXmlDoc(&xmldata);
    &rootNode = &xmlDoc.documentelement;
    &descNode = &rootNode.addelement("SMTPtest");
    &descNode.nodevalue = "This xml will appear in the email";
    
    /* put the XML in the message */
    &msg.setxmldoc(&xmlDoc);
    
    /* send the request */
    &response = %IntBroker.SyncRequest(&msg);
    
  2. In the PeopleSoft Pure Internet Architecture, open the TARGETNODE node definition.

    1. On the Node Definitions-Connectors tab, set the Connector ID to SMTPTARGET.

    2. Set the following properties to the values indicated:

      Property

      Value

      DestEmailAddress

      Set this property to the email address to which the email will be sent.

      SourceEmailAddress

      Set this property to the email address from which you are sending the message.

  3. Access the integrationGateway.properties file. Locate the following line and replace <mailServerName> with the name of the SMTP server.

    ig.connector.smtptargetconnector.host=<mailServerName>
  4. In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button to send the message.

    Check the destination email account for the message. Since the message is being passed through one or more SMTP servers, there may be some propagation delay and the message might not be received immediately.