AsthaIT.MailSender 1.0.5

dotnet add package AsthaIT.MailSender --version 1.0.5
                    
NuGet\Install-Package AsthaIT.MailSender -Version 1.0.5
                    
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="AsthaIT.MailSender" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsthaIT.MailSender" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="AsthaIT.MailSender" />
                    
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 AsthaIT.MailSender --version 1.0.5
                    
#r "nuget: AsthaIT.MailSender, 1.0.5"
                    
#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 AsthaIT.MailSender@1.0.5
                    
#: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=AsthaIT.MailSender&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=AsthaIT.MailSender&version=1.0.5
                    
Install as a Cake Tool

AIT.Packages.MailSender

A .NET package for sending emails using MailKit with support for CC, BCC, and attachments.

Features

  • Sends emails using SMTP
  • Supports for CC and BCC recipients
  • Supports for attachments
  • HTML email body support
  • Secure SMTP connection with SSL/TLS

Installation

Add the package to your project using NuGet:

dotnet add package AsthaIT.MailSender

Usage

  1. Configure the mail settings:
var mailSettings = new MailSettings
{
    Host = "smtp.example.com",
    Port = 587, // Use the port number recommended by your email provider.
    UserName = "your-username",
    Password = "your-password",
    EnableSSL = true,
    FromEmail = "sender@example.com",
    DisplayName = "Sender Name"
};
  1. Create a mail request:
var mailRequest = new MailRequest
{
    To = new List<EmailRecipient>
    {
        new EmailRecipient
        {
            Email = "recipient@example.com",
            DisplayName = "Recipient Name"
        }
    },
    Subject = "Test Email",
    Body = "<h1>Hello World!</h1><p>This is a test email.</p>",
    CC = new List<EmailRecipient>
    {
        new EmailRecipient
        {
            Email = "ccreceiver@example.com",
            DisplayName = "CC Recipient"
        }
    },
    BCC = new List<EmailRecipient>
    {
        new EmailRecipient
        {
            Email = "bccreceiver@example.com",
            DisplayName = "BCC Recipient"
        }
    },
    Attachments = new List<AttachmentInfo>
    {
        new AttachmentInfo
        {
            FileName = "document.pdf",
            ContentType = "application/pdf",
            Content = File.ReadAllBytes("path/to/document.pdf")
        }
    }
};

  1. Send the email:
var mailClient = new AITMailClient(mailSettings);
var response=await mailClient.SendEmailAsync(mailRequest);

Dependencies

  • MailKit

License

MIT License

Author

Developed and maintained by AIT.

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 was computed.  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

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
1.0.5 132 6/26/2025
1.0.4 209 6/2/2025
1.0.3 143 6/2/2025