Indiko.Blocks.Messaging.EMail
2.7.8
dotnet add package Indiko.Blocks.Messaging.EMail --version 2.7.8
NuGet\Install-Package Indiko.Blocks.Messaging.EMail -Version 2.7.8
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="Indiko.Blocks.Messaging.EMail" Version="2.7.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Indiko.Blocks.Messaging.EMail" Version="2.7.8" />
<PackageReference Include="Indiko.Blocks.Messaging.EMail" />
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 Indiko.Blocks.Messaging.EMail --version 2.7.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Indiko.Blocks.Messaging.EMail, 2.7.8"
#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 Indiko.Blocks.Messaging.EMail@2.7.8
#: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=Indiko.Blocks.Messaging.EMail&version=2.7.8
#tool nuget:?package=Indiko.Blocks.Messaging.EMail&version=2.7.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Indiko.Blocks.Messaging.EMail
Email messaging implementation using MailKit/SMTP for sending transactional and marketing emails.
Overview
This package provides email sending capabilities using SMTP with support for HTML emails, attachments, CC/BCC, and template processing.
Features
- SMTP Support: Send via any SMTP server
- HTML & Plain Text: Support for both formats
- Attachments: File attachments support
- CC/BCC: Carbon copy and blind carbon copy
- Template Processing: Built-in template engine
- SSL/TLS: Secure connections
- Async/Await: Full asynchronous support
Installation
dotnet add package Indiko.Blocks.Messaging.EMail
Configuration
appsettings.json
{
"EMailMessagingOptions": {
"Enabled": true,
"SmtpHost": "smtp.gmail.com",
"SmtpPort": 587,
"Username": "your-email@gmail.com",
"Password": "your-app-password",
"FromEmail": "noreply@example.com",
"FromName": "My Application",
"EnableSsl": true,
"Timeout": 30000
}
}
Quick Start
Send Simple Email
public class EmailService
{
private readonly IEMailMessageSender _emailSender;
public EmailService(IEMailMessageSender emailSender)
{
_emailSender = emailSender;
}
public async Task SendWelcomeEmailAsync(string to, string name)
{
var message = new EMailMessage
{
To = new[] { to },
Subject = "Welcome!",
Body = $"<h1>Welcome {name}!</h1><p>Thank you for signing up.</p>",
IsHtml = true
};
var result = await _emailSender.SendAsync(message);
if (!result.Success)
{
throw new Exception($"Failed to send email: {result.ErrorMessage}");
}
}
}
Send with Template
public async Task SendOrderConfirmationAsync(Order order)
{
var template = await File.ReadAllTextAsync("Templates/OrderConfirmation.html");
var placeholders = new Dictionary<string, string>
{
{ "CustomerName", order.CustomerName },
{ "OrderNumber", order.OrderNumber },
{ "OrderDate", order.OrderDate.ToString("D") },
{ "TotalAmount", order.TotalAmount.ToString("C") }
};
var body = _templateEngine.ProcessTemplate(template, placeholders);
var message = new EMailMessage
{
To = new[] { order.CustomerEmail },
Subject = $"Order Confirmation #{order.OrderNumber}",
Body = body,
IsHtml = true
};
await _emailSender.SendAsync(message);
}
Send with Attachments
public async Task SendInvoiceAsync(string to, string invoicePath)
{
var message = new EMailMessage
{
To = new[] { to },
Subject = "Your Invoice",
Body = "<p>Please find your invoice attached.</p>",
IsHtml = true,
Attachments = new List<EmailAttachment>
{
new EmailAttachment
{
FileName = "invoice.pdf",
FilePath = invoicePath,
ContentType = "application/pdf"
}
}
};
await _emailSender.SendAsync(message);
}
Send with CC/BCC
public async Task SendReportAsync()
{
var message = new EMailMessage
{
To = new[] { "manager@example.com" },
Cc = new[] { "supervisor@example.com" },
Bcc = new[] { "archive@example.com" },
Subject = "Daily Report",
Body = GenerateReport(),
IsHtml = true
};
await _emailSender.SendAsync(message);
}
SMTP Providers
Gmail
{
"EMailMessagingOptions": {
"SmtpHost": "smtp.gmail.com",
"SmtpPort": 587,
"Username": "your-email@gmail.com",
"Password": "your-app-password",
"EnableSsl": true
}
}
Note: Use App Passwords for Gmail.
SendGrid
{
"EMailMessagingOptions": {
"SmtpHost": "smtp.sendgrid.net",
"SmtpPort": 587,
"Username": "apikey",
"Password": "your-sendgrid-api-key",
"EnableSsl": true
}
}
Mailgun
{
"EMailMessagingOptions": {
"SmtpHost": "smtp.mailgun.org",
"SmtpPort": 587,
"Username": "postmaster@yourdomain.mailgun.org",
"Password": "your-mailgun-password",
"EnableSsl": true
}
}
AWS SES
{
"EMailMessagingOptions": {
"SmtpHost": "email-smtp.us-east-1.amazonaws.com",
"SmtpPort": 587,
"Username": "your-ses-smtp-username",
"Password": "your-ses-smtp-password",
"EnableSsl": true
}
}
Best Practices
- Use App Passwords: Don't use main account passwords
- Rate Limiting: Implement rate limiting for bulk emails
- Error Handling: Always check send results
- Logging: Log all email operations
- Testing: Use services like Mailtrap for testing
- Unsubscribe: Include unsubscribe links
- SPF/DKIM: Configure SPF and DKIM records
Target Framework
- .NET 10
Dependencies
Indiko.Blocks.Messaging.AbstractionsMailKit(4.0+)
Related Packages
Indiko.Blocks.Messaging.AbstractionsIndiko.Blocks.Messaging.PushNotification
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Indiko.Blocks.Messaging.Abstractions (>= 2.7.8)
- MailKit (>= 4.16.0)
- MimeKit (>= 4.16.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.7.8 | 96 | 5/7/2026 |
| 2.7.7 | 83 | 5/7/2026 |
| 2.7.6 | 130 | 4/23/2026 |
| 2.7.5 | 137 | 4/23/2026 |
| 2.7.4 | 105 | 4/23/2026 |
| 2.7.3 | 97 | 4/23/2026 |
| 2.7.2 | 97 | 4/23/2026 |
| 2.7.1 | 88 | 4/23/2026 |
| 2.7.0 | 89 | 4/23/2026 |
| 2.6.4 | 95 | 4/21/2026 |
| 2.6.3 | 87 | 4/21/2026 |
| 2.6.2 | 89 | 4/21/2026 |
| 2.6.1 | 88 | 4/18/2026 |
| 2.6.0 | 95 | 4/17/2026 |
| 2.5.1 | 107 | 4/14/2026 |
| 2.5.0 | 131 | 3/30/2026 |
| 2.2.18 | 120 | 3/8/2026 |
| 2.2.17 | 90 | 3/8/2026 |
| 2.2.16 | 95 | 3/8/2026 |
| 2.2.15 | 101 | 3/7/2026 |
Loading failed