MyMail (2.1.9)
Installation
dotnet nuget add source --name RAAPEREIRA --username your_username --password your_token dotnet add package --source RAAPEREIRA --version 2.1.9 MyMailAbout this package
Opinionated internal email client built on SmarterMail.Net.
MyMail
A headless .NET email client library providing a simpler API over SmarterMail.Net. Targets .NET Standard 2.0 and .NET 10.
Installation
Install MyMail from your configured NuGet feed:
dotnet add package MyMail
Configuration
Register the library in your application's service collection:
using MyMail.Extensions;
services.AddMyMail(options =>
{
options.BaseUrl = "https://mail.example.com";
options.AllowedEmailDomains = new[] { "example.com" }; // Optional
});
The library registers IMyMailClientFactory. Clients are created on demand;
IMyMailClient is not registered directly in dependency injection.
MyMail delegates server operations to SmarterMail.Net and exposes feature APIs
for mail, calendars, contacts, notes and tasks. SmarterMail failures are wrapped
in MyMailException subtypes, including authentication and operation errors.
For an embeddable Blazor interface, install MyMail.Blazor as well.
Message HTML and inline images
IMyMailFeature.GetMessageHtmlAsync returns a sanitised HTML body that is safe
to render without a session. Inline images (/attachment/inline?... URLs and
cid: references) are resolved with the authenticated client and embedded as
data: URIs, because SmarterMail's inline image URLs require authentication
and return 401 Missing auth when loaded directly by a browser. If an image
cannot be fetched, its URL is rewritten to an absolute URL on BaseUrl instead.
Consequences for consumers:
- Bodies with large inline images are larger (base64 adds about 33%).
- If you render the HTML yourself, your Content-Security-Policy must allow
img-src data:.