Skip to content

SendMail - Recipient same object: Error #2935

@michaelmairegger

Description

@michaelmairegger

Describe the bug

I want to send an email to BCC recipients and as regular recipient to me.

If sender and recipient is the same Recipient object the API call results to

At least one recipient is not valid., Recipient '' is not resolved. All recipients must be resolved before a message can be submitted.

If sender and recipient are two differenc Recipient objects then the API call works

Expected behavior

Allows to assign to ToRecipients and From the same Recipient object

How to reproduce

Send an email with the following code:

var sender = new Recipient { EmailAddress = new EmailAddress { Address = "SENDER_EMAIL" } };

var message = new Message
              {
                  ToRecipients = [sender],
                  BccRecipients = recipientList,
                  From = sender
              };

FillMessage(message, item); // internal method to create body, ...

var request = new SendMailPostRequestBody
              {
                  Message = message,
                  SaveToSentItems = true
              };

await gsc.Users["REDACTED"].SendMail.PostAsync(request, cancellationToken: stoppingToken);

SDK Version

5.81.0

Latest version known to work for scenario above?

No response

Known Workarounds

var recipient = new Recipient { EmailAddress = new EmailAddress { Address = "SENDER_EMAIL" } };
var sender = new Recipient { EmailAddress = new EmailAddress { Address = "SENDER_EMAIL" } };

var message = new Message
              {
                  ToRecipients = [recipient],
                  BccRecipients = recipientList,
                  From = sender
              };
FillMessage(message, item); // internal method to create body, ...

var request = new SendMailPostRequestBody
              {
                  Message = message,
                  SaveToSentItems = true
              };

await gsc.Users["REDACTED"].SendMail.PostAsync(request, cancellationToken: stoppingToken);

Debug output

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions