c# - 使用 openpop 连接到 Outlook 时提供的主机名应该是什么
问题描述
我正在使用 openPop 库连接到电子邮件并使用我的 c# 代码获取。
我可以通过提供服务器详细信息作为主机名:“pop.gmail.com”,端口:995,SSL:true insdide client.connect() 方法从 gmail 帐户获取邮件。然后调用 client.Authenticate("recent: " + 用户名、密码、AuthenticationMethod.UsernameAndPassword)。但是当我尝试访问 Outlook 邮件时,更改凭据后无法连接。以下是我分别用于连接 gmail 和 Outlook 的代码。
//gmail连接
var client = new Pop3Client();
using (Pop3Client client2 = new Pop3Client())
{
// Connect to the server
client.Connect("pop.gmail.com", 995, true);
client.Authenticate("recent:" + userName, password,
AuthenticationMethod.UsernameAndPassword);
}
//前景连接
var client = new Pop3Client();
using (Pop3Client client2 = new Pop3Client())
{
// Connect to the server
client.Connect("outlook.office365.com", 995, true);
client.Authenticate("recent:" + userName, password, AuthenticationMethod.UsernameAndPassword);
}
我在使用 Outlook 凭据时遇到错误,如下所示: PopServerException:服务器未响应 + 响应。响应是:“-ERR 登录失败:未知用户名或密码错误。” 我还在 POP 和 IMAP 下启用了内部 Outlook 设置,在允许设备和应用程序使用 POP 下设置为是。
解决方案
推荐阅读
- php - 没有完整堆栈框架的 Symfony 组件(第 2 集)
- mysql - 在 MySql 中的简单删除查询中出现错误
- java - 如果 fromTime 和 toTime 中的偏移量发生变化,如何处理 DB 日志搜索查询中的区域偏移量变化
- reactjs - 将 json-server 与使用 aws amplify 部署的反应应用程序集成
- java - 如何在 Java 8 中使用 Keytool API 而不是 Process Builder?
- angular - agm-map 控制选项无法正常工作
- react-native - React Native:未定义不是对象(评估'_useContext.width')
- excel - 使用 For Each on Rows 集合时,将行值作为字符串复制到 Variant
- python - Python 3.7 错误:AttributeError:模块“子进程”没有属性“运行”
- python - 如何创建一个以文件名作为键、行的第一个字符(在文件中)作为值的字典?