Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Email csv file from local machine using cMail component throws Null Pointer

Hi 

I am trying to send the CSV file from my local machine via email using cMail component. The code in my cProcessor is below is :

import java.io.File;

String path = "C:\\Users\\Talend\\Downloads\\Report_20190226.csv";
exchange.getIn().addAttachment(path.substring(path.lastIndexOf("\\")+1), new javax.activation.DataHandler(new javax.activation.FileDataSource(path)));
exchange.getIn().setBody("Hello");
System.out.println(path);

but it gives the following exception: 

java.lang.NullPointerException

Please help me where my exchange is getting null.
The flow is shown in the image attached.

Thanks

Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi,

 

   Before doing the processing, could you please print and verify whether the file names are parsed in the right way?

 

   Please assign the data to a variable and print the steps like last index parse. It should give you a clue.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hi Nikhil Thampi,

I am getting the path and file name but not able to receive email with attachment.
Anonymous
Not applicable
Author

Hi Ameen,

 

    Could you please provide the component screenshots also for the problematic components?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hi Nikhil,

I have already attached the image in my first post. Please look at that.
One more thing it is from Talend 5.3