Unable to send the mails through office 365

CD_TVFS 1 Reputation point

We have a functionality in our Dot.net/C# based application which creates an outlook mail and sends to the recipients on their outlook email id. Up till now, it has been working fine but since last week, it has stopped working such that the mails are not getting sent to the recipients. Upon debugging, we found that it is giving an exception error as “The request failed. The remote server returned an error: (401) Unauthorized”. After finding solutions over various portals and taking help from our internal Infra team, we got to know that, to connect with server to send the mail, up till base authentication/protocol was used. But now, since Microsoft has enforced to the clients users to shift towards Modern authentication- OAuth 2.0, we are struggling to incorporate the same into our existing code and setup. We need assistance in knowing the steps in simple manner required to shift to Modern protocols.

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,504 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 49,051 Reputation points

    You don’t which library you are using to send mail. If it is system.net.mail you will need a replacement library. Microsoft suggests graph api, but you can find smtp libraries that support oauth,

    The libraries that support oauth often require you to supply the code to fetch the token.

    0 comments No comments