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

Multiple attachments support #24

Closed albertchua closed 1 week ago

albertchua commented 1 year ago

Hi,

How to send an email with multiple attachments? 2.1.2 doesn't seem to support it.

Regards, Albert

Marmeladov commented 1 year ago

Hi all What's the plan for when attaching multiple attachments in API SDK? Just let me know if I missed documentation examples on how to do that.

lvukadinovic-ib commented 1 week ago

Hi @albertchua, @Marmeladov, sorry for the late response and thank you for your patience. We've released a new version (3.0.1) that allows you to send an email with multiple attachments. You can find the example of usage in the snippet below:

string attachmentFilePath = "/temp/info.txt";
FileStream attachment = new FileStream(attachmentFilePath, FileMode.Open, FileAccess.Read);

string anotherAttachmentFilePath = "/temp/icon.png";
FileStream anotherAttachment = new FileStream(anotherAttachmentFilePath, FileMode.Open, FileAccess.Read);

EmailSendResponse sendResponse = emailApi.SendEmail(
    from: "john.smith@somedomain.com",
    to: new List<string>
    {
        "jane.smith@somecompany.com"
    },
    subject: "Mail subject text",
    text: "Test message with file",
    attachment: new List<FileParameter>
    {
        attachment,
        anotherAttachment
    }
);

I'm marking this as closed. Feel free to reopen the issue if it still persists.

Kind regards, Luka