Bitzsoft.Integrations.EnterpriseMail.NetEase 1.0.0-alpha.9

This is a prerelease version of Bitzsoft.Integrations.EnterpriseMail.NetEase.
dotnet add package Bitzsoft.Integrations.EnterpriseMail.NetEase --version 1.0.0-alpha.9
                    
NuGet\Install-Package Bitzsoft.Integrations.EnterpriseMail.NetEase -Version 1.0.0-alpha.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.EnterpriseMail.NetEase" Version="1.0.0-alpha.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.EnterpriseMail.NetEase" Version="1.0.0-alpha.9" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.EnterpriseMail.NetEase" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.EnterpriseMail.NetEase --version 1.0.0-alpha.9
                    
#r "nuget: Bitzsoft.Integrations.EnterpriseMail.NetEase, 1.0.0-alpha.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.EnterpriseMail.NetEase@1.0.0-alpha.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.EnterpriseMail.NetEase&version=1.0.0-alpha.9&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.EnterpriseMail.NetEase&version=1.0.0-alpha.9&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.EnterpriseMail.NetEase

网易企业邮箱集成,基于 IMAP/SMTP 协议(MailKit)实现 IEnterpriseMailProvider

功能特性

  • IMAP/SMTP 协议,通过 MailKit 库管理持久连接
  • 全功能支持:收发、搜索、移动、删除、文件夹管理、附件(无 NotSupportedException)
  • IMAP SEARCH 服务端搜索,支持按关键词精确搜索
  • 自动重连,连接断开时自动重新建立连接

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.EnterpriseMail.NetEase

PackageReference

<PackageReference Include="Bitzsoft.Integrations.EnterpriseMail.NetEase" Version="1.0.0" />

配置

{
  "NetEase": {
    "Username": "user@company.com",
    "Password": "xxxxxxxxxxxxxxxx"
  }
}
配置项 说明 默认值
ImapHost IMAP 服务器地址 hwimap.qiye.163.com
ImapPort IMAP 端口 993
SmtpHost SMTP 服务器地址 hwsmtp.qiye.163.com
SmtpPort SMTP 端口 994
Username 邮箱账号
Password 邮箱密码或授权码
UseSsl 是否使用 SSL true

注册服务

// 方式一:委托配置
services.AddBitzsoftNetEaseMail(options =>
{
    options.Username = "user@company.com";
    options.Password = "xxxxxxxxxxxxxxxx";
});

// 方式二:IConfiguration 绑定
services.AddBitzsoftNetEaseMail(configuration, "NetEase");

使用示例

using Bitzsoft.Integrations.EnterpriseMail;
using Bitzsoft.Integrations.EnterpriseMail.NetEase;
using Bitzsoft.Integrations.EnterpriseMail.Models;

// 通过 DI 注入 IEnterpriseMailProvider
public class MailService
{
    private readonly IEnterpriseMailProvider _mail;

    public MailService(IEnterpriseMailProvider mail) => _mail = mail;

    public async Task SendAsync()
    {
        await _mail.SendAsync(new SendMailRequest
        {
            Subject = "通知",
            HtmlBody = "<p>测试邮件</p>",
            To = [new MailAddress { Address = "user@example.com" }],
        });
    }

    public async Task<MailMessage> GetDetailAsync()
    {
        // messageId 格式: folderId:uid(例如 INBOX:12345)
        return await _mail.GetMessageAsync("INBOX:12345");
    }
}

核心类型一览

类型 说明
NetEaseMailProvider 网易邮箱服务实现(IEnterpriseMailProvider
NetEaseMailOptions 网易邮箱配置选项

依赖

  • Bitzsoft.Integrations.EnterpriseMail,企业邮箱抽象层
  • Bitzsoft.Integrations.Compatibility,基础工具库
  • MailKit,IMAP/SMTP 协议库

注意事项

  • 网易企业邮箱无公开的邮件操作 REST API,仅能通过 IMAP/SMTP 协议交互
  • 邮件使用复合标识格式 folderId:uid(如 INBOX:12345),若传入纯 UID 则默认在 INBOX 中查找
  • 附件标识为数字索引(从 0 开始)
  • IMAP/SMTP 客户端注册为 Singleton,内部使用信号量保证线程安全
  • Provider 名称:NetEase

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.EnterpriseMail.NetEase:

Package Downloads
Bitzsoft.Integrations.EnterpriseMail.All

企业邮箱服务聚合包 — 包含所有供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.9 55 7/12/2026
1.0.0-alpha.8 56 7/1/2026
1.0.0-alpha.7 71 6/16/2026
1.0.0-alpha.6 69 6/16/2026
1.0.0-alpha.5 56 6/14/2026
1.0.0-alpha.3 64 6/7/2026