Download a file and send through email

I want to Send a downloaded Excel sheet as attachment - I need to do this every day and I need to send the file which is downloaded just 2 min back How do i send email with an attachment which is downloaded latest in a folder…

Hi @sanjay_gowda ,

The following query will help you retrieve the latest Excel File downloaded.

Directory.GetFiles(Downloadpath).Select(Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(".xlsx")).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString

As for the mail, you can simple declare the attachment variable and pass this in as input.

1 Like

One way is to use the “Wait for Download” activity (see the screenshot below) to download a file and specify the downloaded file name .

You can attach the file name in “Send Email” or similar activity.

1 Like

Hello @liu_shubin ,

Here how can I attached that downloaded file in mail…

Thank you

If you are using Outlook, you can use “Send Outlook Mail Message” activity following the screenshot below. If you are using other Send email activities, you can fill in file name in “attachment” field.

1 Like

Hi @liu_shubin ,
Thank you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.