包信息
| 属性 | 值 |
|---|---|
| NuGet 包 | Bitzsoft.Integrations.EnterpriseMail.NetEase |
| Provider ID | netease |
| 协议 | IMAP + SMTP(MailKit) |
| 生命周期 | Singleton |
配置字段(NetEaseMailOptions)
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
ImapHost | string | 否 | hwimap.qiye.163.com | IMAP 服务器地址 |
ImapPort | int | 否 | 993 | IMAP 服务器端口(SSL) |
SmtpHost | string | 否 | hwsmtp.qiye.163.com | SMTP 服务器地址 |
SmtpPort | int | 否 | 994 | SMTP 服务器端口(SSL) |
Username | string | 是 | — | 登录用户名(邮箱地址) |
Password | string | 是 | — | 登录密码或授权码 |
UseSsl | bool | 否 | true | 是否使用 SSL 连接 |
配置示例
{ "EnterpriseMail": { "NetEase": { "ImapHost": "hwimap.qiye.163.com", "ImapPort": 993, "SmtpHost": "hwsmtp.qiye.163.com", "SmtpPort": 994, "Username": "user@your-domain.com", "Password": "your-password-or-auth-code", "UseSsl": true } }}DI 注册
// ① 配置节绑定builder.Services.AddBitzsoftNetEaseMail(builder.Configuration.GetSection("EnterpriseMail:NetEase"));
// ② 委托配置builder.Services.AddBitzsoftNetEaseMail(options =>{ options.Username = "user@your-domain.com"; options.Password = "your-password-or-auth-code";});使用示例
public class NetEaseMailService(IEnterpriseMailProvider mail){ public async Task<MailListResult> SearchAsync(string keyword) { return await mail.SearchAsync(new MailSearchRequest { Keyword = keyword, FolderId = "INBOX", }); }}已知限制
- IMAP 协议限制:文件夹创建/删除依赖网易 IMAP 实现,部分操作可能不支持。
- 单账户:一个 Provider 实例绑定一个邮箱账户(
Username),不支持多账户切换。 - MailKit 依赖:通过 MailKit 库实现 IMAP/SMTP,不使用 HttpClientFactory。
相关
- 企业邮箱域手册:供应商对比与 Singleton 说明