How to Send mail using gmail with Talend
This is a very common requirement by every talend user when it is required to send mail in different scenarios. These scenarios are
- Successful completion of a job
- Failure of job or subjobs
- On particular event or based on condition or specific variable value
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
In order to send mail, mail server details are required. It may be possible that the client may provide server details, but often they are not provided. In this case, you can create an account on gmail with specific user name like etl_info@gmail.com. To send mail using gmail, talend consists of a component tSendMail.
Following settings are required inside tSendMail component to send mail using newly created gmail account. They are as follows
SMTP Host – “smtp.gmail.com”
SMTP Port – 465
SSL Support – Enabled
Need authentication – Enabled
username – “newusername@gmail.com”
password – “yourpassword”
Use above settings to send mail using your gmail account.
Conditional mail Sending
When you want to send mail when particular condition arises after completion of your subjob, then you can connect tSendMail component using if clause and fill the condition variable with required condition say
context.variable >= 10
When you want to send mail when failure of particular subjob, then connect the subjob to tSendMail component and use system variable for that subjob where value is 1. Condition could be
((Integer)globalMap.get(“tRunJob_1_CHILD_RETURN_CODE”)) ==1
When you want to send mail on success, then connect another tSendMail component with following condition
((Integer)globalMap.get(“tRunJob_1_CHILD_RETURN_CODE”)) == 0
Vaibhav Waghmare
Best Open Source Business Intelligence Software Helical Insight is Here