Page 1 of 1

How to attach and send external file through email

Posted: Tue Apr 05, 2016 8:04 pm
by gowthamp
Hello,

I am updating file in "C:\Users\testuser\Documents\test.txt" local machine with time taken to complete module group in Ranorex.

In TEARDOWN I am converting report file to pdf and sending through email. I would like to attach and send updated "test.txt" file along with that pdf.
I am using the attached Csharp file to send reports in form of pdf through email.

Can someone guide me, in attaching external file along with PDF report?

Thanks,

Re: How to attach and send external file through email

Posted: Thu Apr 07, 2016 9:40 am
by Support Team
Hello gowthamp,

You simply can add the file as an attachment, as you already did with the PDF:

Code: Select all

attachment = new System.Net.Mail.Attachment("LOCAL FILE PATH");
                   mail.Attachments.Add(attachment);
Hope this information helps.

Sincerely,
Robert

Re: How to attach and send external file through email

Posted: Fri Apr 08, 2016 3:24 pm
by gowthamp
Thanks Robert,

Now I came to know how to attach external files.