Free Support Forum - aspose.com

IndexOutOfRangeException when send an email with the new Graph client

I am using this code to find out how to send an email with the Graph client:

           asposeClient = GraphClient.GetClient(new MsTokenProvider(auth, server.Address), auth.TenantId);

            var asposeMessage = new Aspose.Email.MailMessage();
            asposeMessage.From = message.From;
            asposeMessage.To = message.To;
            asposeMessage.Subject = message.Subject;
            asposeMessage.Body = message.TextBody;

            var msg = MapiMessage.FromMailMessage(asposeMessage);
            asposeClient?.Send(msg);

It throws this error:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ☼ .:slight_smile:(MapiMessage :slight_smile:)
at ☼ .:slight_smile: ()
at :clubs: .:clubs: ?:heart:()
at .Send(MapiMessage :slight_smile:)

Am I doing something wrong?

@marieke.saeij,

Can you pleas provide the message file that you are using and which is throwing exception on your end.