Importing Email Attachments using the POP3 Connector icon

Importing Email Attachments using the POP3 Connector

(0 reviews)

home

Shows you how to use the POP3 connector to facilitate information transfer through email. It also illustrates how to use DataMapper to transform a CSV file to XML.

Example

In this example a CSV file containing sample sales data which has been received as an attachment in a mail inbox is imported using the POP3 connector. The DataMapper then converts the CSV file to the XML format. The logger then logs this data on the studio console.

Set Up and Run this Example

  1. Open the project in the Studio interface

  2. Click the POP3 endpoint in the Mule flow and edit its properties as follows:

        pop3.host=pop.gmail.com
        pop3.port=995
        pop3.user=receiveremailaddress%40gmail.com
        pop3.password=receiver_password
  3. Run the project as a Mule application

  4. Navigate to src/main/resources and use any email address to send the 'input.csv' file as an attachment to receiveremailaddress@gmail.com

  5. If you have configured and run this example correctly, the csv file should appear in XML format in the studio console. The log message should be similar to what is shown below:

     INFO  2017-07-07 16:49:09,973 [[pop3-to-xml-master].POP3.receiver.01] org.mule.api.security.tls.TlsPropertiesMapper:         Defaulting mule.email.pop3s trust store to client Key Store
     WARN  2017-07-07 16:49:09,988 [[pop3-to-xml-master].POP3.receiver.01] org.mule.api.security.tls.TlsProperties: File         tls-default.conf not found, using default configuration.
     INFO  2017-07-07 16:49:10,706 [[pop3-to-xml-master].pop-to-xmlFlow1.stage1.02]
     org.mule.api.processor.LoggerMessageProcessor: recieved: <?xml version="1.0" encoding="UTF-8"?>
     < orders>
     < order>
     < orderId>1< /orderId>
     < name>aaa< /name>
     < units>2.0< /units>
     < pricePerUnit>10< /pricePerUnit>
     < /order>
     < /orders>
     < orders>
     < order>
     < orderId>2< /orderId>
     < name>bbb< /name>
     < units>4.15< /units>
     < pricePerUnit>5< /pricePerUnit>
     < /order>
     < /orders>
  6. After processing the attachment, it is saved in the src/tests/resources/output folder in XML format.

Documentation

Read full documentation in GitHub

Examples to Try Next

If you understood this example
Importing an Email Attachment using the IMAP Connector - Learn how to use the IMAP connector to transfer information via email.View
If you struggled with this example
Import Contacts Into Salesforce - Learn how to take a CSV file of contacts and upload them to Salesforce.View

Reviews

TypeExample
OrganizationMulesoft Inc.
Published by
MuleSoft Organization
Published onMar 17, 2018
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0