{"id":4427,"date":"2025-04-12T07:26:49","date_gmt":"2025-04-12T07:26:49","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4427"},"modified":"2025-04-12T07:26:51","modified_gmt":"2025-04-12T07:26:51","slug":"exchange-online-imap-pop3-and-smtp-credentials-flow-testing-oauth","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4427","title":{"rendered":"Exchange Online IMAP, POP3 and SMTP Credentials Flow Testing (OAuth)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">As a test we are using OpenSSL to perform some credentials testing using an Enterprise Application configured in Microsoft 365 to connect using IMAP(S) and SMTP via OpenSSL to validate how OAuth modern authentication works.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-CreateEnterpriseApplication\">Create Enterprise Application<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly we create an Enterprise Application, we are going to be using Win64 OpenSSL v3.3.3 Light on our test machine, but in a way that doesn&#8217;t really matter.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-4-1024x533.png\" alt=\"\" class=\"wp-image-4430\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-4-1024x533.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-4-300x156.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-4-768x400.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-4.png 1506w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Add the Permissions for the Application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s a little bit tricky. Instead of Microsoft Graph select the \u201cAPIs my organization uses\u201d and search for \u201cOffice 365 Exchange Online\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5-1024x538.png\" alt=\"\" class=\"wp-image-4431\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5-1024x538.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5-300x158.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5-768x403.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5-1536x807.png 1536w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-5.png 1544w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then select \u201cApplication permissions\u201d and search for \u201cPOP\u201d and \u201cIMAP\u201d and &#8220;SMTP&#8221;&nbsp;Office 365 Exchange Online<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>IMAP.AccessAsApp<\/li>\n\n\n\n<li>POP.AccessAsApp<\/li>\n\n\n\n<li>SMTP.SendAsApp<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once completed that is the Enterprise Application configured.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-CreateEnterpriseApplicationSecret\">Create Enterprise Application Secret<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Now we need to create a &#8220;Client Secret&#8221; for the Enterprise Application, so click on &#8220;Certificates &amp; Secrets&#8221;, then create &#8220;New Client Secret&#8221;, we&#8217;ll need this value later on when we come to generating the OAuth token. Note that when you create the secret, you need to take the value of the key, and this will then not be visible, also bear in mind this is effectively a password, so keep it safe!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"513\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6-1024x513.png\" alt=\"\" class=\"wp-image-4432\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6-1024x513.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6-300x150.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6-768x385.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6-1536x769.png 1536w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-6.png 1565w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-CreateExchangeOnlineServicePrincipal\">Create Exchange Online Service Principal<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to create the Service Principal in Exchange Online. The Service Principal in Exchange Online allows the Enterprise Application to interact with objects (e.g. Mailboxes) within Exchange Online.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create the Service Principal you use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>New-ServicePrincipal -AppId $AppID -ServiceId $objectID &#91;-Organization $TenantID]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So what are all these variables? You can find these from the Application &#8220;Overview&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"525\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-7-1024x525.png\" alt=\"\" class=\"wp-image-4433\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-7-1024x525.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-7-300x154.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-7-768x394.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-7.png 1279w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Identified above as per their colours:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Application (Client) ID<\/strong> (Red)<\/li>\n\n\n\n<li><strong>Service ID \/ Object ID<\/strong> (Green)<\/li>\n\n\n\n<li><strong>Directory (Tenant) ID<\/strong> (Blue)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So substituting in the values for our particular example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>New-ServicePrincipal -AppId 10e1f456-3921-1234-1234-105af0774c61 -ServiceId 3187e945-569d-1234-1234-48fbb71963d9 -Organization 9b62d4ed-1234-1234-b00d-341a1bd0b3f5 -DisplayName \"EXO Serviceprincipal Win64 OpenSSL v3.3.3 Light\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The\u00a0Organisation ID\u00a0is option from what we can tell.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also create via PowerShell, to do this you need to ensure you have the MS Graph and Exchange Online PowerShell Modules installed and active.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-MgGraph -Scopes 'Application.Read.All'\n  \n$ServicePrincipalDetails = Get-MgServicePrincipal -Filter \"DisplayName eq 'Win64 OpenSSL v3.3.3 Light'\"\n$ServicePrincipalDetails\n  \nConnect-ExchangeOnline\nNew-ServicePrincipal -AppId $ServicePrincipalDetails.AppId -ServiceId $ServicePrincipalDetails.Id -DisplayName \"EXO Serviceprincipal $($ServicePrincipalDetails.Displayname)\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note that: &#8220;Get-MgServicePrincipal&#8221; retrieves the list of Enterprise Applications, &#8220;Get-ServicePrincipal&#8221; retrieves the list of Exchange Online Service Principals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Right, now we can check it has been created OK, that would be a yes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\Users\\Administrator.BLAH> get-serviceprincipal\n \nDisplayName                              ObjectId                                                                                      AppId\n-----------                              --------                                                                                      -----\nEXO Serviceprincipal Win64 OpenSSL v3... 7e9d0608-db24-1234-1234-c8d03424192d                                                          10e1f456-1234-1234-971b-105af0774c61<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll notice that the &#8220;AppId&#8221; value matches the Enterprise Application &#8220;Application (Client) ID&#8221;; which shows that link between the two.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-Check(andEnable)IMAP,POPandSMTPonAccount\">Check (and Enable) IMAP, POP and SMTP on Account<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">In our example we using the account zh1@blah.org.uk, so we&#8217;ll check it first with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-CASMailbox -Identity zh1@blah.org.uk<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And then apply the relevant settings (if required), its recommended to just run these anyway! We want POP, IMAP to be set to &#8220;True&#8221; and SMTPClientAuthenticationDisabled to be set to &#8220;False&#8221;.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set-CASMailbox -Identity zh1@blah.org.uk -PopEnabled $true -ImapEnabled $true -SmtpClientAuthenticationDisabled $false<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-SetPermissionsonAccount\">Set Permissions on Account<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Now we need our Service Principal to have access to our mailbox, we apply this with the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$Mailbox = \"zh1@blah.org.uk\"\n$ServicePrincipal = \"EXO Serviceprincipal Win64 OpenSSL v3.3.3 Light\"\nAdd-MailboxPermission -Identity $Mailbox -User $ServicePrincipal -AccessRights FullAccess -AutoMapping $false<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We then should get the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\Users\\Administrator.BLAH> Add-MailboxPermission -Identity $Mailbox -User $ServicePrincipal -AccessRights FullAccess -AutoMapping $false\n  \nIdentity             User                 AccessRights                                                                                                               IsInherited Deny\n--------             ----                 ------------                                                                                                               ----------- ----\n128c533d-2f09-406... S-1-5-21-20157833... {FullAccess}                                                                                                               False       False<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We can then check the permissions with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$Mailbox = \"zh1@blah.org.uk\"\nGet-MailboxPermission  -Identity $Mailbox | Where-Object { ($_.AccessRights -eq \"FullAccess\") -and ($_.IsInherited -eq $false) -and -not ($_.User -like \"NT AUTHORITY\\SELF\") } | ft -AutoSize<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All being well we should then see this if all is well.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\Users\\Administrator.BLAH> Get-MailboxPermission  -Identity $Mailbox | Where-Object { ($_.AccessRights -eq \"FullAccess\") -and ($_.IsInherited -eq $false) -and -not ($_.User -like \"NT AUTHORITY\\SELF\") } | ft -AutoSize\n \nIdentity                             User                                            AccessRights IsInherited Deny\n--------                             ----                                            ------------ ----------- ----\n128c533d-2f09-4063-816e-e7cf765a26e4 EXO Serviceprincipal Win64 OpenSSL v3.3.3 Light {FullAccess} False       False<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We are now ready to start our tests!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note that permissions application does not appear to be instant within Exchange Online, it can take up to 60 minutes, well it did for us, before the configuration took effect, although it appeared to have taken straight away when reviewing PowerShell output.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-GetOAUTHToken\">Get OAUTH Token<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Now we need to get the OAUTH token which we&#8217;ll then use in the two upcoming tests. A script has been prepared for this, all you need to do is enter the relevant values for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>$targetmailbox &#8211; The target mailbox, e.g. &#8220;zh1@blah.org.uk&#8221;.<\/li>\n\n\n\n<li>$clientId &#8211; The ClientID, which is the\u00a0<strong>Application (Client) ID<\/strong>, note the\u00a0red, that you discovered earlier.<\/li>\n\n\n\n<li>$tenantId &#8211; The TenantId you can obtain from the Entra ID Overview page, its your underlying &#8220;onmicrosoft.com&#8221; ID.<\/li>\n\n\n\n<li>The ClientSecret, but specifically the bit after &#8220;ConvertTo-SecureString&#8221; is where you subsitute the value you created in the section &#8220;Create Enterprise Application Secret&#8221; earlier.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You need to install the PowerShell modules (if not done so already):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -Name MSAL.PS\nInstall-Module -Name JWTDetails<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then create a script called get-token.ps1:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Import-Module MSAL.PS\nImport-Module JWTDetails\n \n$targetmailbox = \"zh1@blah.org.uk\"\n$clientId = \"10e1f456-1234-1234-971b-105af0774c61\"\n$tenantId = \"blahorguk.onmicrosoft.com\"\n$ClientSecret = ConvertTo-SecureString \"&lt;Secret Key in here>\" -AsPlainText -Force\n$Scope = \"https:\/\/outlook.office.com\/.default\"\n \nClear-MsalTokenCache\n \n$authresult = Get-MsalToken -Scope $Scope -ClientId $clientId -TenantId $tenantId -ClientSecret $ClientSecret\n \n$accessToken = $authresult.AccessToken\n \nwrite-host $accessToken\n \nGet-JWTDetails -token $accessToken\n \n$Text = \"user=\" + $targetmailbox + \"$(&#91;char]0x01)auth=Bearer \" + $accessToken + \"$(&#91;char]0x01)$(&#91;char]0x01)\"\n \nwrite-host $Text\n \n$Bytes = &#91;System.Text.Encoding]::ASCII.GetBytes($Text)\n \n$EncodedText = &#91;Convert]::ToBase64String($Bytes)\n \nwrite-host\nwrite-host $EncodedText\nwrite-host\nwrite-host \"IMAP XOAUTH2\" -ForegroundColor Green\nwrite-host \"C02 AUTHENTICATE XOAUTH2 $EncodedText\"\nWrite-Host\nwrite-host \"SMTP XOAUTH2\" -ForegroundColor Green\nwrite-host \"AUTH XOAUTH2 $EncodedText\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When you run the script you&#8217;re using the Client Secret, you created earlier to authenticate, and get an OAUTH token, the script outputs the AUTH requests as two separate outputs, which slightly different commands at the front to use in each of the tests IMAP and SMTP respectively. You&#8217;ll see these highlighted with green titles.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\\get-token.ps1<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"294\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-8-1024x294.png\" alt=\"\" class=\"wp-image-4434\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-8-1024x294.png 1024w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-8-300x86.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-8-768x220.png 768w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-8.png 1399w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-TestingIMAP\">Testing IMAP<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">You can now use OpenSSL to perform the tests, note that on Microsoft Windows, we had problems with getting OpenSSL to work correctly with the commands, we were constantly seeing &#8220;BAD Command Error 12&#8221; when using the Microsoft Windows OpenSSL ports, but it worked fine on Ubuntu Linux.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, firstly connect with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl s_client -connect outlook.office365.com:993 -crlf -quiet<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Issue the first command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C01 CAPABILITY<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now enter the second command which includes the OAUTH authentication string, the key is omitted in the below for security\/brevity.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C02 AUTHENTICATE XOAUTH2 &lt;Big long key you copied out of the PowerShell script here><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure you are pasting in the above command on a single line, not multiple lines.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All being well you should see an output of:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"53\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-9.png\" alt=\"\" class=\"wp-image-4435\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-9.png 590w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-9-300x27.png 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you now issue a list command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>A01 LIST \"\" *<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We should see the mailbox folder structure, and if we can the test has been successful!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"620\" height=\"366\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-10.png\" alt=\"\" class=\"wp-image-4436\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-10.png 620w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-10-300x177.png 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-TestingSMTP\">Testing SMTP<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Testing SMTP is similar to testing IMAP but the connection command is different.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl s_client -starttls smtp -connect outlook.office365.com:587 -crlf -quiet\n  \nEHLO blah.org.uk\n  \nAUTH XOAUTH2  &lt;Big long key you copied out of the PowerShell script here><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All being well you should then see,\u00a0<strong>235 2.7.0 Authentication Successful<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"70\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-11.png\" alt=\"\" class=\"wp-image-4437\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-11.png 484w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/04\/image-11-300x43.png 300w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s send an email:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mail from:zh1@blah.org.uk\nrcpt to:ts01@blah.org.uk\ndata\nFrom:zh1@blah.org.uk\nTo:ts01@blah.org.uk\nSubject:Hello There! from SMTP CLI\nHi, this is a test from the SMTP CLI, typing the commands in one by one. Not tried Thunderbird yet, but that works differently anyway.\n.\nquit<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use lower case: rcpt to, rather than upper case RCPT TO.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All being well you should have received the email in the destination mailbox, if so, the test has been successful!<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-Conclusion\">Conclusion<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">So we have been to verify and test the use of an Enterprise Application to send email as a user via IMAP and SMTP.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExchangeOnlineIMAP,POP3andSMTPCredentialsFlowTesting(OAuth)-AdditionalInformation\">Additional Information<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.icewolf.ch\/archive\/2022\/12\/17\/exchange-online-pop-and-imap-oauth-2-0-client-credentials\/\">https:\/\/blog.icewolf.ch\/archive\/2022\/12\/17\/exchange-online-pop-and-imap-oauth-2-0-client-credentials\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.icewolf.ch\/archive\/2022\/12\/20\/exchange-online-other-ways-of-testing-imap-oauth2-client-credential\/\">https:\/\/blog.icewolf.ch\/archive\/2022\/12\/20\/exchange-online-other-ways-of-testing-imap-oauth2-client-credential\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.icewolf.ch\/archive\/2023\/07\/24\/Exchange-Online-IMAP-and-SMTP-OAuth-2-0-with-Delegated-Permissions\/\">https:\/\/blog.icewolf.ch\/archive\/2023\/07\/24\/Exchange-Online-IMAP-and-SMTP-OAuth-2-0-with-Delegated-Permissions\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>As a test we are using OpenSSL to perform some credentials testing using an Enterprise Application configured in Microsoft 365 to connect using IMAP(S) and SMTP via OpenSSL to validate how OAuth modern authentication works. Create Enterprise Application Firstly we create an Enterprise Application, we are going to be using Win64 OpenSSL v3.3.3 Light on &#8230; <a title=\"Exchange Online IMAP, POP3 and SMTP Credentials Flow Testing (OAuth)\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4427\" aria-label=\"Read more about Exchange Online IMAP, POP3 and SMTP Credentials Flow Testing (OAuth)\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4439,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-4427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-365"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4427"}],"version-history":[{"count":2,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4427\/revisions"}],"predecessor-version":[{"id":4438,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4427\/revisions\/4438"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4439"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}