You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2012-01-27 14:57:10

ponzio
Member
38 posts

ponzio said:

Save and Rename mail attachments

Hi.
I need to download and rename mail attachments.
I'm daily receiving an email whose subjects contain the date while the attachment name is always the same.
I need to save the attachment and RENAME it with the mail subject.

Please help.

Many thanks, in advance,
Andrea

Offline

#2 2012-01-29 04:47:48

pedro
Member
3682 posts

pedro said:

Re: Save and Rename mail attachments

Hi Andrea

You can use tPOP component to fetch mail, use tFileInputMail to export attachments.
Then use tFileCopy to rename attachments.

Best regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-01-30 08:52:26

ponzio
Member
38 posts

ponzio said:

Re: Save and Rename mail attachments

Hi Pedro.
Thanks for your answer ....

Just a couple of questions:

1) using the tInputMail I've the problem that it overwrites the attachments file if I'm gettingm ore than one un-read email ...
a possibile workaround is to extract only one email anceh then using a LOOP to downaload all the emails...any other ideas ?

2) using the tFileCopy, how can I pass to it the email subject to compose the new attachment name ? (sorry but I'm very new using Talend)

Thanks,
Andrea

Offline

#4 2012-01-30 09:21:35

pedro
Member
3682 posts

pedro said:

Re: Save and Rename mail attachments

Hi Andrea

1)
You can set "Attachment export directory" of tFileInputMail like this to avoid overwriting.

"E:/Attachment/"+context.sequence+"/"                   //context.sequence will be increased by tJava(context.sequence++)

Export each attachment into an unique directory.
2) You can set "Mail parts" of tFileInputMail as follows. Then extract this field into a variable.

Column   Mail part
Object     "Subject"

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-01-30 10:05:13

ponzio
Member
38 posts

ponzio said:

Re: Save and Rename mail attachments

1) You can set "Attachment export directory" of tFileInputMail like this to avoid overwriting.

"E:/Attachment/"+context.sequence+"/"                   //context.sequence will be increased by tJava(context.sequence++)

Ok, I'm going to try this ... but I'll nedd a way to give the exact name (related to the subject) to the proper directory attachment ...

2) You can set "Mail parts" of tFileInputMail as follows. Then extract this field into a variable.

Column   Mail part
Object     "Subject"

I did it .. I'm writing a csv file with the sender and subject of the downloaded emails ...
My problem is to pass the subject to che tCOPY.

Thanks,
Andrea

Offline

#6 2012-01-30 10:10:55

pedro
Member
3682 posts

pedro said:

Re: Save and Rename mail attachments

Hi Andrea

To pass the subject to tCopy.
You can create job as the following images with the csv file.

Regards,
Pedro


Only Paranoid Survive.

Offline

#7 2012-01-30 10:44:20

ponzio
Member
38 posts

ponzio said:

Re: Save and Rename mail attachments

It works !

Many many thanks

Offline

#8 2012-01-30 14:26:28

ponzio
Member
38 posts

ponzio said:

Re: Save and Rename mail attachments

Just another question ... is it possible to get the attachment name ?

Andrea

Offline

#9 2012-01-31 02:29:57

pedro
Member
3682 posts

pedro said:

Re: Save and Rename mail attachments

Hi

No. It's impossible to get the attachment name directly now.

Regards,
Pedro


Only Paranoid Survive.

Offline

#10 2012-05-04 13:47:48

st_germain
Member
9 posts

st_germain said:

Re: Save and Rename mail attachments

Hi, can you please explain exactly, how I can detach the attachments with tInputMail?
The original filename is in my case in the subject ...

Offline

#11 2012-05-07 03:30:19

pedro
Member
3682 posts

pedro said:

Re: Save and Rename mail attachments

Hi St_germain

tFileInputMail can detach attachments automatically if you offer correct path for "Attachment export directory".

Regards,
Pedro


Only Paranoid Survive.

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy