Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

July 2022

How to send SMTP email with Power Automate Desktop (PAD)

Demo how to send SMTP email with Power Automate Desktop (PAD) including:

  • PAD example flow with attachment
  • PAD email step failure error
  • PowerShell to enable SMTP tenant level
  • Outlook web mail showing Inbox delivery success

535: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled

VIDEO

SCREENSHOT

POWERSHELL CODE – ENABLE SMTP TENANT

Install-Module ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName spjeffdev@spjeffdev.onmicrosoft.com
Set-TransportConfig -SmtpClientAuthenticationDisabled $true

ERROR MESSAGE

535: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [CH2PR05CA0070.namprd05.prod.outlook.com]: Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to send email message. —> MailKit.Security.AuthenticationException: 535: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [CH2PR05CA0070.namprd05.prod.outlook.com] —> MailKit.Net.Smtp.SmtpCommandException: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [CH2PR05CA0070.namprd05.prod.outlook.com]
— End of inner exception stack trace —
at MailKit.Net.Smtp.SmtpClient.d__69.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Smtp.SmtpClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken)
at MailKit.MailService.Authenticate(Encoding encoding, String userName, String password, CancellationToken cancellationToken)
at Microsoft.Flow.RPA.Desktop.Modules.Email.Actions.EmailActions.SendEmail(Variant from, Variant senderDisplayName, Variant to, Variant cc, Variant bcc, Variant subject, Variant body, Variant attachments, Variant smtpServer, Variant username, Variant varPassword, Boolean isBodyHtml, Int32 serverPort, Boolean needsAuthentication, Boolean enableSsl, Boolean acceptUntrustedCertificates)
— End of inner exception stack trace —
at Microsoft.Flow.RPA.Desktop.Modules.Email.Actions.SendEmail.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary2 inputArguments, Dictionary2 outputArguments)

REFERENCES

How to report Azure Admin Roles granted with PowerShell into CSV

Report of all Azure Admin Roles granted with PowerShell into CSV. Leverages module AzureAD and only requires Azure AD reader.

Cheers

VIDEO

SCREENSHOT

SOURCE CODE

https://github.com/spjeff/office365/tree/master/Azure-Admin-Roles

REFERENCES

Query Azure AD (Connect-AzureAD) unattended with Azure App Registration certificate PFX

Demo showing how to query Azure AD in PowerShell. Walk each step with full PowerShell source code available.

  1. Execute “Connect-AzureAD” with admin user
  2. Create self signed certificate PFX for unattended login
  3. Create new App Registration
  4. Grant permission “User.ReadAll” to MS Graph API
  5. Execute “Connect-AzureAD” with unattended certificate PFX login
  6. Execute query “Get-AzureADUser” to display results

Please leave comment with suggestions and questions. Cheers.

SOURCE CODE

https://github.com/spjeff/spadmin/blob/master/Connect-AzureAD.ps1

VIDEO

REFERENCES

  • https://docs.microsoft.com/en-us/powershell/module/azuread/connect-azuread?view=azureadps-2.0
  • https://docs.microsoft.com/en-us/powershell/module/azuread/new-azureadapplicationkeycredential?view=azureadps-2.0
  • https://erjenrijnders.nl/2018/08/30/azuread-login-without-credentials-unattended/

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲