[英]Mailkit using Imap to connect to Hotmail and fetch emails
I have been searching for code examples of fetching emails from Hotmail using Mailkit via Imap.我一直在寻找通过 Imap 使用 Mailkit 从 Hotmail 获取电子邮件的代码示例。 Unfortunately, I have not found anything worked for me.
不幸的是,我没有发现任何对我有用的东西。
I can see that Hotmail supports Imap now and Microsoft is pushing to use GraphClient to do the job.我可以看到 Hotmail 现在支持 Imap,Microsoft 正在推动使用 GraphClient 来完成这项工作。 But I cannot figure out how to connect to Hotmail.
但是我不知道如何连接到 Hotmail。
Not sure this is caused by not correct code or I cannot turn on IMAP for my registered app(Web) on Azure.不确定这是由不正确的代码引起的,或者我无法在 Azure 上为我注册的应用程序(Web)打开 IMAP。
Every time when I tried to turn it on, it throws this error每次当我试图打开它时,它都会抛出这个错误
IPublicClientApplication _msalClient;
string[] _scopes = new string[2] { "Mail.Read", "User.Read"};
IAccount _userAccount;
_msalClient = PublicClientApplicationBuilder
.Create("xxxxxxxxxxxxxxx")
.WithAuthority(AadAuthorityAudience.AzureAdAndPersonalMicrosoftAccount, true)
.Build();
var result = await _msalClient.AcquireTokenWithDeviceCode(_scopes, callback => {
Console.WriteLine(callback.Message);
return Task.FromResult(0);
}).ExecuteAsync();
return result.AccessToken;
This was a temporary issue in our rollout process and is now fixed.这是我们推出过程中的一个临时问题,现已修复。 You should now be able to add IMAP, POP, SMTP permissions to your app and acquire tokens.
您现在应该能够向您的应用程序添加 IMAP、POP、SMTP 权限并获取令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.