I have followed the steps on this page https://adamtheautomator.com/azure-send-email. What I am trying to do is send an email out from a Ps script.
I get the error message below.
VERBOSE: POST https://graph.microsoft.com/v1.0/users/xxxxxxxxx@domain.com/sendMail with -1-byte payload
Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:65 char:1
+ Invoke-RestMethod @params -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
What have I done ?
Did some research and found a similar question, How to get mailbox for my new Azure Active Directory Domain?
At the moment I am trying to send the email as myself (using my email address). I do however have a mailbox created for alerts, so I could send as that user, the issue I have here is that with the 404 error it means the endpoint is incorrect.
"URI" = "https://graph.microsoft.com/v1.0/users/$fromAddress/sendMail"
I am unsure as to what to use as the sender email address, the link suggests that the user sending out the email alert should have a mailbox. You need an O365 subscription for your AAD, then you can assign the license to the users which you need a mailbox.
We use O365, I have a mailbox, how can i tell if AAD has a o365 subscription ? How can i tell that i am using the correct sender email address, during my research I saw examples using name@domain.com and in some cases name.domain.onmicrosoft.com. I have tried several combinations to no avail, this should not be a guessing game, how can I be sure of using the right details ?