Hello everyone,
I am creating an automation script where I am writing to a csv file.
In the end of the automation script, I would like to send an email with that file attached.
Do you know how to implement this?
Kind regards,
Carolina
Hi Carolina!
In case you are reading the file from your File System this could be an option:
engine.SendSLNetMessage(
new SendEmailMessage
{
To = [YOUR_E-MAIL_HERE] Body = "This an example e-mail! :)",
IsHtml = false,
Attachments = new[] {
new EmailAttachment
{
Data = File.ReadAllBytes([YOUR_FULL_FILE_PATH]),
FileName = [FILENAME_IN_THE_ATTACHMENT],
},
},
});
I've tested this with .csv and .txt files and seemed to work fine. Hope it helps!
Thanks João! It solved my issue 🙂