Bitzsoft.Integrations.EnterpriseMail
1.0.0-alpha.9
This is a prerelease version of Bitzsoft.Integrations.EnterpriseMail.
dotnet add package Bitzsoft.Integrations.EnterpriseMail --version 1.0.0-alpha.9
NuGet\Install-Package Bitzsoft.Integrations.EnterpriseMail -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" 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" Version="1.0.0-alpha.9" />
<PackageReference Include="Bitzsoft.Integrations.EnterpriseMail" />
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 --version 1.0.0-alpha.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.EnterpriseMail, 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@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&version=1.0.0-alpha.9&prerelease
#tool nuget:?package=Bitzsoft.Integrations.EnterpriseMail&version=1.0.0-alpha.9&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.EnterpriseMail
企业邮箱服务抽象层,定义统一接口与强类型模型,屏蔽飞书、阿里、腾讯、Microsoft 365、网易等供应商差异。
功能特性
- 统一操作接口
IEnterpriseMailProvider,屏蔽底层供应商差异,提供一致的邮件操作 API - 邮件操作:发送、列表、详情、搜索、删除、移动
- 文件夹管理:列表、创建、删除
- 附件管理:列表、下载
- 强类型模型,所有接口返回不可变(
init)强类型模型,IReadOnlyList<T>保证集合只读 - 可扩展架构,实现
IEnterpriseMailProvider即可接入新的邮箱供应商
安装
.NET CLI
dotnet add package Bitzsoft.Integrations.EnterpriseMail
PackageReference
<PackageReference Include="Bitzsoft.Integrations.EnterpriseMail" Version="1.0.0" />
注册服务
本包为抽象层,不包含具体供应商配置。请查阅各实现包的文档:
- Feishu — 飞书邮箱
- Alibaba — 阿里邮箱
- Tencent — 腾讯企业邮箱
- Microsoft365 — Microsoft 365
- NetEase — 网易企业邮箱
使用示例
发送邮件
using Bitzsoft.Integrations.EnterpriseMail;
using Bitzsoft.Integrations.EnterpriseMail.Models;
public class MailService
{
private readonly IEnterpriseMailProvider _provider;
public MailService(IEnterpriseMailProvider provider)
{
_provider = provider;
}
public async Task SendNotificationAsync(string to, string subject, string body)
{
var request = new SendMailRequest
{
Subject = subject,
HtmlBody = body,
To = [new MailAddress { Address = to }],
};
var result = await _provider.SendAsync(request);
Console.WriteLine($"发送成功: {result.IsSuccess}");
}
}
获取邮件列表
public async Task<List<MailMessage>> GetRecentMailsAsync()
{
var result = await _provider.ListMessagesAsync("INBOX", pageIndex: 1, pageSize: 20);
Console.WriteLine($"共 {result.TotalCount} 封邮件,当前页 {result.Messages.Count} 封");
return result.Messages.ToList();
}
搜索邮件
public async Task<MailListResult> SearchAsync(string keyword)
{
var request = new MailSearchRequest
{
Keyword = keyword,
UnreadOnly = true,
PageIndex = 1,
PageSize = 10,
};
return await _provider.SearchAsync(request);
}
核心类型一览
| 类型 | 说明 |
|---|---|
IEnterpriseMailProvider |
企业邮箱操作核心接口(11 个方法 + ProviderName 属性) |
MailMessage |
邮件消息(正文、收发件人、附件、标志等) |
MailAddress |
邮件地址(地址 + 显示名称) |
MailAttachment |
附件元数据(ID、文件名、类型、大小) |
MailFolder |
文件夹信息(ID、名称、类型、未读/总数) |
MailListResult |
分页邮件列表结果 |
MailSearchRequest |
搜索请求(关键词、日期范围、发件人等) |
SendMailRequest |
发送邮件请求(正文、收件人、附件等) |
SendMailResult |
发送结果(IsSuccess + MessageId) |
MailPriority |
邮件优先级枚举(Low / Normal / High) |
MailFolderType |
文件夹类型枚举(Inbox / Sent / Drafts / Junk / Trash / Custom) |
MailFlags |
邮件标志枚举(Read / Flagged / Answered / Forwarded / HasAttachments) |
EnterpriseMailException |
供应商异常(ProviderName + Message) |
依赖
Microsoft.Extensions.DependencyInjection,DI 容器支持
相关包
- Bitzsoft.Integrations.Compatibility — 基础工具库
- Bitzsoft.Integrations.EnterpriseMail.Feishu — 飞书邮箱实现
- Bitzsoft.Integrations.EnterpriseMail.Alibaba — 阿里邮箱实现
- Bitzsoft.Integrations.EnterpriseMail.Tencent — 腾讯企业邮箱实现
- Bitzsoft.Integrations.EnterpriseMail.Microsoft365 — Microsoft 365 邮箱实现
- Bitzsoft.Integrations.EnterpriseMail.NetEase — 网易企业邮箱实现
- Bitzsoft.Integrations.EnterpriseMail.All — 全部供应商聚合包
| Product | Versions 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.
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.9)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.9)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.9)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Bitzsoft.Integrations.EnterpriseMail:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.EnterpriseMail.Microsoft365
Microsoft 365 企业邮箱服务实现 |
|
|
Bitzsoft.Integrations.EnterpriseMail.Alibaba
阿里企业邮箱服务实现 |
|
|
Bitzsoft.Integrations.EnterpriseMail.Feishu
飞书企业邮箱服务实现 |
|
|
Bitzsoft.Integrations.EnterpriseMail.Tencent
腾讯企业邮箱服务实现(企业微信邮件 API) |
|
|
Bitzsoft.Integrations.EnterpriseMail.NetEase
网易企业邮箱服务实现(IMAP/SMTP) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.9 | 71 | 7/12/2026 |
| 1.0.0-alpha.8 | 323 | 7/1/2026 |
| 1.0.0-alpha.7 | 91 | 6/16/2026 |
| 1.0.0-alpha.6 | 91 | 6/16/2026 |
| 1.0.0-alpha.5 | 83 | 6/14/2026 |
| 1.0.0-alpha.3 | 93 | 6/7/2026 |