I can't comment on the above-accepted answer; hence, I am providing another answer.
Please note a few changes for the sample code to work in 2024.
https://
as it is appended by the library./
at the end of the communication-server. It leads to the wrong auth header and results in 401.example:
payload: = emails.Payload {
Headers: emails.Headers {
ClientCorrelationID: "some-correlation-id",
ClientCustomHeaderName: "some-custom-header",
},
SenderAddress: "<[email protected]>",
Content: emails.Content {
Subject: "Fabric tenant abcde wants to upgrade to paid offer",
PlainText: "This is being generated from dev-server.",
HTML: "<p>This is a <strong>test</strong> email.</p>",
},
Recipients: emails.Recipients {
To: [] emails.ReplyTo {
{
Address: "[email protected]",
DisplayName: "Garima Bathla",
},
},
},
Attachments: [] emails.Attachment {},
UserEngagementTrackingDisabled: false,
}
SenderAddress: "<[email protected]>",