Send attachment with email

Hi everyone.

I have a robot that data scrapes a website and saves the result in a .csv file - everything is working fine.
Now I want to add to the robot that it should send the .csv file to my email after the file is created.

I use google smtp and I can send mails via the robot, but I cant figure out how to attach the .csv file. Basically these fields:

Best regards

1 Like

Kindly mention the full path of that csv file in that attach file window
That is the file path of that cvs file
Cheers @Peter_C


Here you need to pass the CSV file path.

@Peter_C you can create a new string variable FilePath, then assign the file path of your csv file. Then input the FilePath on the Value field of the Attach Files window.

Hi - Thanks.

I got it it send an email with the attacment by using this: Environment.CurrentDirectory+"\Rapporter\file.csv"

But my files has a DATE (“MM-dd-yyyy_hh_mm_ss”) like so: file01-09-2020_03_47_11.csv
so there anyway to attach those files. Can I make a variable that contains the file(s) - if so how?

Best regards

Try this: Environment.CurrentDirectory+"\Rapporter\file"+ DateTime.Now.ToString(“MM-dd-yyyy_hh_mm_ss”)+".csv"

That did not work because the files that are made by data scraping has a differend timestamp.

Maybe I can explain it this way: I want so send all csv-files in a folder but this does not work:
I cannot use ‘*’

My robot data scrapes and makes csv files. These files names will be named with the time+date: as shown here:

- after the files are made I want them send to me by email - hope you understand :slight_smile:

After scraping, assign DateTime.Now.ToString(“MM-dd-yyyy_hh_mm_ss”) to a String variable TimeStamp so that the time stamp will be the same as the file name of the csv file… use this later to attach the file:
Environment.CurrentDirectory+"\Rapporter\file"+ TimeStamp+".csv"