Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
vlntn
Contributor III
Contributor III

Attach files to email and send with SMTP / Notification Connector

Hi all,

I'm currently sending emails through the Data Load Editor via SMTP / Notification Connector .

Now I wanted to attach Excel / CSV files to that emails. Unfortunately, I couldn't figure out how to do that.

Has anyone an idea how to attach files to emails and send them out via the Data Load Editor?

That's the code where I tried to implement the attachment:

LET vDefaultFromName = 'NoReply';
LET vDefaultFromEmail = 'jd@email.com';
LET vAttachment = "lib://PathToExcelFile.xlsx";


SUB SendMail(vsndm.force, vsndm.to, vsndm.cc, vsndm.subj, vsndm.msg)

SendMailLog: LOAD * INLINE [DateTime,EmailHash];

LET vHash = Hash256(vsndm.to, vsndm.cc, vsndm.subj, vsndm.msg);

IF FieldIndex('EmailHash', vHash) = 0 OR vsndm.force THEN

LIB CONNECT TO 'REST Email Connection';

RestConnectorMasterTable:
SQL SELECT "status", "result", "filesattached"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
WITH CONNECTION (
QUERY "to" "$(vsndm.to)"
,QUERY "cc" "$(vsndm.cc)"
,QUERY "subject" "$(vsndm.subj)"
,QUERY "message" "$(vsndm.msg)"
,QUERY "fromName" "$(vDefaultFromName)"
,QUERY "fromEmail" "$(vDefaultFromEmail)"
,QUERY "fileAttachment" "$(vAttachment)"
,QUERY "format" "csv"
);

LET vWasSent = Peek('status', 0, 'SendStatus');
DROP TABLE RestConnectorMasterTable;
ENDIF
END SUB

 

Labels (3)
0 Replies