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

Cannot have multiple recipient in a single email #18

Closed kenlai3974 closed 1 week ago

kenlai3974 commented 1 year ago

I am not able to have multiple recipients in a single email. I checked the source code on the SendEmail function. It seems it is not supported.

                SendEmailApi sendEmailApi = new SendEmailApi(configuration);  
                var emailResponse = sendEmailApi.SendEmail(  
                    from: "some-email",  
                    to: "a@a.com,b@b.com", //How to do this??  
                    subject: "Some_subject",  
                    HTML: "Some_html",  
                    trackopens: false,  
                    track: false  
                );  
ib-fsrnec commented 1 year ago

Hi @kenlai3974, sorry for the late response.

Thank you very much for raising an issue. Yes, it is possible to add multiple recipients through to/cc/bcc form parameters like this:

curl --request POST 'https://api.infobip.com/email/3/send' \ ... --form 'to="john.smith@somedomain.com"' \ --form 'to="john.doe@somedomain.com"' \ ...

Unfortunately, the SDK itself doesn't provide the support for adding multiple recipients. This is going to be included in our new major release. We'll keep you informed. Here is the similar issue that was reported for our Java client some time ago: https://github.com/infobip/infobip-api-java-client/issues/20#issuecomment-1383730183.

Thank you for using our library! Best regards, Filip

davorivankovic commented 3 weeks ago

Hi @kenlai3974,

We've released a new version (3.0.0) which fixes this issue. Please check https://github.com/infobip/infobip-api-csharp-client/blob/c4361b83989d0d304edcf4d908879be7a46d487f/src/Infobip.Api.Client/Api/EmailApi.cs#L558 for more details. I'm marking this as closed. Feel free to reopen the issue if it still persists.

Kind regards, Davor

lvukadinovic-ib commented 3 weeks ago

Hi @kenlai3974,

it turned out that there is another issue that is preventing sending mail with multiple recipients using SDK which was not resolved in version 3.0.0. We'll try to provide a patch for it ASAP. Sorry for the confusion, I'm reopening the issue.

Kind regards, Luka

lvukadinovic-ib commented 1 week ago

Hi @kenlai3974, we've fixed the issue in the latest version (3.0.1). You can now send an email to multiple recipients e.g. :

emailApi.SendEmail(
    from: "john.smith@somedomain.com",
    to: new List<string> {
        "jane.doe@somecompany.com",
        "alice.someone@somedomain.com",
        "carol.someone@somedomain.com"
    },
    subject: "Email with multiple recipients",
    text: "Sent using Infobip API C# Client"
);

Sorry again for the confusion. You can freely reopen the issue if it still persists.

Kind regards, Luka