Attachments in tSendMail

Hi,
I try to make a job:
Read Directory----Iterate---> Send a mail with attachments (all docs read in directory)

I try with:
tFileList-->tSendMail with the value " ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))" in attachment
The result is: X files send X mails with attachment.
All documents are not in only 1 mail

Nicolas
PS: I'm beginner in Talend DI
Nicolas
15 REPLIES
One Star

Re: Attachments in tSendMail

It's normal because an Iterate" connection between the 2 components means that tSendMail will be triggered once for each file in that folder.
The first solution i can suggest is to use a tFileArchive component to zip your files, connect it to tSendMail component with the OnSubjobOk trigger and in the Attachment section, you will type: ((String)globalMap.get("tFileArchive_1_ARCHIVE_FILEPATH")) as the attached file.
This way you will send only one email with all your files.
Regards
AH.
Seven Stars

Re: Attachments in tSendMail

I believe you can just use a filemask in tSendMail i.e. you don't need tFileList at all.

Re: Attachments in tSendMail

The 2 solutions are avalaible:
The first (with TfileArchive): Connect the tfileArchive to tSendMail
In the attachment file: ((String)globalMap.get("tFileArchive_2_ARCHIVE_FILEPATH"))
The second:Just add the directory of files in the attachments
Thank you alevy & cheaito
Moderator

Re: Attachments in tSendMail

Hi,
Actually, so far tsendmail only support for file mask with a directory without filter on file type. That means "D:/folder2/" is OK not "D:/folder2/*.txt".
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star ns
One Star

Re: Attachments in tSendMail

Could we have an inline attachment in message body instead of attachment section using tsendmail component ?
Moderator

Re: Attachments in tSendMail

Hi,
Could we have an inline attachment in message body instead of attachment section using tsendmail component ?

For the inline attachment in message body, could you give more information and elaborate your case with an example to us?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star ns
One Star

Re: Attachments in tSendMail

Well example could be as simple as any .tsv / .csv report that is generated with header and data already available in some location and we would like to have them displayed in the body instead of as an attachment.
Moderator

Re: Attachments in tSendMail

Hi,
Well example could be as simple as any .tsv / .csv report that is generated with header and data already available in some location and we would like to have them displayed in the body instead of as an attachment.

It seems you want to put the .tsv / .csv file/file path in Message Body of tsendmail?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star ns
One Star

Re: Attachments in tSendMail

Yes , with the content (not just the file name / path ) . If it's not something supported i would really appreciate work arounds ?
Moderator

Re: Attachments in tSendMail

Hi,
Actually, the message body can accept "String" type.
You can paste attachment content into message body, however, it cannot be marked as "attachment" auto instead being a part of message.
Is there any trouble of "Attachment" section in tSendMail for you?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Attachments in tSendMail

Hi Team,
How i can send attached mail in zip format.
Thanks
shrihdar
One Star

Re: Attachments in tSendMail


How do i give the file path here for tsendmail? its giving me error
Twelve Stars

Re: Attachments in tSendMail

415061/mini_blob_20170308-1205.png
How do i give the file path here for tsendmail? its giving me error

 "/" at the end of filename wrong
-----------
One Star

Re: Attachments in tSendMail

that is resolved. But its sending an empty file when it has to suppose send the data. Please see my job below:

Twelve Stars

Re: Attachments in tSendMail

delete row9(main) and connect tSENDMail with DataLoad (source) by OnSubJobOk
-----------