'Sending emails between accounts using Microsoft Graph using Azure AD produces invalid IP error

I registered a daemon app in Azure AD and am creating a class to do some basic things like send and delete emails but I get an error when trying to send between two @*.onmicrosoft.com email boxes. I am able to send from Gmail to these emails for example but not between the two emails for some reason.

Error: error

The way I am sending emails is as follows:

    public async Task Send(string[] to, string subject, string body, FileInfo[] attachments = null, bool saveToSentItems = true, bool isBodyHTML = false)
    {
        var msg = new Message
        {
            Subject = subject,
            Body = new ItemBody { ContentType = (isBodyHTML) ? BodyType.Html : BodyType.Text, Content = body },
            ToRecipients = to.ToList().Select(x => new Recipient() { EmailAddress = new EmailAddress { Address = x } })
        };

        await graphClient.Users[email].SendMail(msg, saveToSentItems).Request().PostAsync();
    }


Solution 1:[1]

So I think it's because of trial licenses and couldn't figure out way yet to turn off the IP filtering:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jabda001