One Star

Send bulk email using tsendmail component

Dear sanvaibhav,
I have a job requirement in which i have to take email ids from the excel sheet and send the email notification to that email ids.
excel sheet is containing list of email ids.
Regards,
Csah
16 REPLIES
Four Stars

Re: Send bulk email using tsendmail component

Hi,
tfileInputExcel-->tjavarow-->titeratetoflow-->tpop
Read your column containing excel file
Create context variable email_id
Assign value of incoming row to context variable in tjavarow
use context variable in tpop for mail Id
Try using similar logic/concept.
Vaibhav
Seventeen Stars

Re: Send bulk email using tsendmail component

hi,
have also a look at tSendMail (some procedure as described by sanvaibhav : iterate is the key word )
https://help.talend.com/search/all?query=tSendMail&content-lang=en
regards
laurent
One Star

Re: Send bulk email using tsendmail component

Hi sanvaibhav,
could you show me an example for the same..

Regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

Hi,
Following is example itself - tfileInputExcel-->tjavarow-->titeratetoflow-->tpop
Read your column containing excel file
Create context variable email_id
Assign value of incoming row to context variable in tjavarow
use context variable in tpop for mail Id
Try implementing it and whatever problem you face, pl let us know.
Try implementing solution from following example. You will understand the basic of how to use iterate...
https://help.talend.com/search/all?query=tIterateToFlow&content-lang=en
This will help you
Vaibhav
One Star

Re: Send bulk email using tsendmail component

Hi Vaibhav,
i am able to send the email notification to the recipient using the below logic
tfilieinputexcel---------> tflowtoiterate----->tsendmail

but i want to send the html email template in the body of the email
Please suggest...
Regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

Hi,
Please check the discussion at http://community.talend.com:80/t5/Design-and-Development/How-to-inject-html-code-into-message-of-tSe....
largouwalid implemented message with image and other formatting including html template...
Vaibhav
One Star

Re: Send bulk email using tsendmail component

Hi Vaibhav,

Can you help me regarding how to get the log file of the talend job after exporting it.
means what we are getting in the console tab.

Regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

Whatever you get on console you can redirect it to the job, but need to do some small java coding...
pl check the blog - http://helicaltech.com/redirecting-talend-console-logs/
Code is simple
java.io.File logFile = new java.io.File(?_logs/?+projectName+?.log?);
java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(logFile));
System.setOut(ps);
System.setErr(ps)
This writes logs as well as info from console to file.
Thanks
Vaibhav
One Star

Re: Send bulk email using tsendmail component

Hi Vaibhav,

Could you tell me where to connect the tjava with the which component as per my job

Regards
Csah
Four Stars

Re: Send bulk email using tsendmail component

In your first job -
tPreJob-->OnComponentOk-->tJava
YourJob-->Follows-->here
One Star

Re: Send bulk email using tsendmail component

Hi Vaibhav ,
Good Morning....

I am able to generate the log file of the talend job but when i am executing the .bat (Standalone execution) then i am not able to generate the log file..
Regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

I think you are missing something...
Have you checked the validation for directory creation... directory is not created because it does not exists...
java.io.File log_folder = new java.io.File(System.getProperty("user.dir")+"/_logs1/");
if (!log_folder.exists())
{
if (log_folder.mkdir())
{
//System.out.println("Directory is created!");
}
else
{
//System.out.println("Failed to create directory!");
}
}
java.io.File logFile = new java.io.File(System.getProperty("user.dir")+"/_logs1/"+projectName+".log");
java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(logFile));
System.setOut(ps);
System.setErr(ps);

This works... I tested again for your.
Thanks
Vaibhav
One Star

Re: Send bulk email using tsendmail component

Thanks vaibhav ,

Every thing is working fine...
Now i have one more requirement let support i want the log of the failed email ids means that email id in which the notification mail has not sent by the job due to any reason..

Thanks in advance..
Regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

tSendMail would send mail for every mail ID. Mail server sends the mail, but it may turn out to be not delivered due to mail ID problem. This returned mail is available in Inbox.
You can write another job to read the mails from this mailbox using tpop and check for failure mails.
Another way could be to use OnSubJobError for tSendMail, you can get the error generated for particular mail ID.
Vaibhav
One Star

Re: Send bulk email using tsendmail component

Thanks vaibhav

one more thind i am not able to send the mail when i am using the ip address in place of the smtp host and port number is 25.

i am gettind error "Unrecognized SSL message, plaintext connection?"

please do the needful.
regards,
Csah
Four Stars

Re: Send bulk email using tsendmail component

Whether you are able to connect to the mail server using IP. Usually the mail server is like smtp.mail.com...
Whether SSL configuration is required for your mail serve?
Check your mail server settings..
Refer to https://help.talend.com/search/all?query=tSendMail&content-lang=en
Vaibhav