Blog

Email - What to do when sending an email with the Mail connector returns a 401 error

Are you receiving a 401 error when attempting to send an email with the 'Send an email notification (V3)' action? Discover why this happens and the workarounds you can use instead.

Sending email notifications is a common requirement and the Power Platform offers various connectors to achieve this, including the "Send an email notification (V3)" action from the Mail connector. 

The Mail connector is particularly useful because it doesn't require us to set up any accounts or authenticate beforehand. This makes it a convenient option for quick and straightforward email notifications. 

An error that users increasingly report is that 401 errors arise when calling this action, particularly with new tenants.

Recreating the error in Power Apps

In Power Apps, we can recreate this issue by adding the Mail connector.



We then add a button and call the following formula.

Mail.SendEmailV3("recipeint@gmail.com", "Email Subject", "Email body", false)

When we run this formula, we receive the error "Mail.SendEmailV3 failed: The server returned an HTTP error with code 401." (shown below).



Unfortunately, there isn't much more to diagnose this error.

If we attempt to do the same in Power Automate, we see the same error.



Why a 401 error occurs when calling the SendEmailV3

The reason for this is that the Mail connector is now restricted for new tenants. 

The documentation has been amended as shown below.

https://learn.microsoft.com/en-us/connectors/sendmail/?WT.mc_id=DX-MVP-5004229




As specified here, there is no way to work around this issue if it's been restricted for your tenant.

Therefore, the only option is to use another mail connector, such as the Office 365 Outlook, Gmai, or SendGrid connectors.

Conclusion

If you attempt to send an email with the Mail connector by calling the "Send an email notification (V3)" connector, you may receive a 401 error. There isn't much detail to diagnose this error. The cause is that the connector will have been restricted and the only alternative is to use another connector.