If you are working on Mule ESB and wondering how to configure SMTP connector in Mule flow to send emails then below are steps that might help you to do it.
Few Points before we start –
- I am on MAC OS X El Capitan (Latest version as of 10/10/2015)
- I am using Mule Anypoint Studio 5.3.1 and Mule Enterprise Runtime 3.7 (current latest)
In my demo application, I have one flow which uses DataWeave to convert XML file into JASON format. I wanted to email thisJASON data using Mule. I have two flows here –
Flow 1: Generate JASON file
- Read the XML file using File inbound connector.
- Convert it into JASON using DataWeave.
- Write JASON file to file system using File Outbound connector.
- Write converted JASON string to VM endpoint
Flow 2: Send content via email
- Listen to the content on same VM endpoint where it is being written in Flow 1
- Configure SMTP to send out email using iCloud SMTP server. Below are the configuration properties
iCloud SMTP servers as per – https://support.apple.com/en-us/HT202304
User: This should be your icloud id without @icloud.com. I tried with @icloud.com and it fails to start.
Password: your iCloud password
To: Recipient’s email id
From: This has to be your complete iCloud email id. Using any other email id not associated with your iCloud account would result in error – “com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.0 From address is not one of your addresses.”
After all these settings, If I now start my Mule Server and provide the input file, Flow 1 converts the file to JASON and Flow 2 sends out that data to target recipient using my iCloud account.
Hope this helps!