C
C#10mo ago
Simba

How authenticate an SMTP connection using oauth2 for sending mail ( office 365) in c#?

Hello everyone, I have a little question about SMTP: How authenticate an SMTP connection using oauth2 for sending mail ( office 365) in c#? The application is registered on Azure Ad (Microsoft entry ID). On this one I have active Microsoft graph and Microsoft exchange online If it is not possible there is a work around Thanks in advance.
4 Replies
lycian
lycian10mo ago
Are you trying to use the MS graph APIs? I think all you need is to use https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http and have a bearer token (which oauth2 would give you I think)
user: sendMail - Microsoft Graph v1.0
Send the message specified in the request body using either JSON or MIME format.
lycian
lycian10mo ago
I think SMTP is being deprecated
Simba
SimbaOP10mo ago
I want to use mailkit.
Simba
SimbaOP10mo ago
https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md i tried these steps but I would like more information step by step. It is a MVC application that need send mail office 365. The application is registered on Azure ad
GitHub
MailKit/ExchangeOAuth2.md at master · jstedfast/MailKit
A cross-platform .NET library for IMAP, POP3, and SMTP. - jstedfast/MailKit
Want results from more Discord servers?
Add your server