infobip / infobip-api-csharp-client

Infobip API client library in C#, distributed as a NuGet package.
https://www.infobip.com/docs/api
MIT License
11 stars 17 forks source link

How to send email with attachments? #23

Closed MatijaSestak closed 1 year ago

MatijaSestak commented 1 year ago

Hi. Please can you give me an example how to send email with attachments in C#. I want to send an email to multiple recipients. Since the API doesn't support it I'm using an example with RestSharp. I don't understand how to add an attachment. i tried with .AddFile() in IRestRequest but nothing comes with the email. I see that the "attachment" parameter needs to be defined, but I don't understand how to add some file(s).

Which class in C# language should I use instead of 'org.springframework.web.multipart.MultipartFile' in Java?

MatijaSestak commented 1 year ago

In InfoBip documentation is wrong example. It shouldn't be

restRequest.AddParameter('attachment', ...); but byte[] testFile = File.ReadAllBytes(file); restRequest.AddFile("attachment", testFile, file);