Soenneker.Extensions.Dtos.Email 3.0.4

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Extensions.Dtos.Email --version 3.0.4
                    
NuGet\Install-Package Soenneker.Extensions.Dtos.Email -Version 3.0.4
                    
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="Soenneker.Extensions.Dtos.Email" Version="3.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.Dtos.Email" Version="3.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.Dtos.Email" />
                    
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 Soenneker.Extensions.Dtos.Email --version 3.0.4
                    
#r "nuget: Soenneker.Extensions.Dtos.Email, 3.0.4"
                    
#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.
#addin nuget:?package=Soenneker.Extensions.Dtos.Email&version=3.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.Dtos.Email&version=3.0.4
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.Dtos.Email

A collection of helpful EmailDto extension methods

📧 Features

  • Converts a well-defined EmailDto into a MimeKit MimeMessage
  • Supports both html and plain formats
  • Adds To, Cc, Bcc, and Reply-To addresses
  • Automatically attaches files via EmailAttachmentDto
  • Sets headers for High and Low priority emails
  • Logs malformed recipients using ILogger

🧪 Validation

The extension validates:

  • Required fields: To, Subject, and Body
  • Non-null, non-whitespace addresses
  • Optionally logs issues rather than throwing for individual recipient fields

Installation

dotnet add package Soenneker.Extensions.Dtos.Email

🔧 Usage

var mimeMessage = emailDto.ToMimeMessage(logger);

📁 Example EmailDto

var dto = new EmailDto
{
    To = new List<string> { "to@example.com" },
    Cc = new List<string> { "cc@example.com" },
    Bcc = new List<string> { "bcc@example.com" },
    ReplyTo = "reply@example.com",
    Name = "Sender Name",
    Address = "sender@example.com",
    Subject = "Test Subject",
    Body = "<p>This is a test email.</p>",
    Format = EmailFormat.Html,
    Priority = EmailPriority.High,
    Attachments = new List<EmailAttachmentDto>
    {
        new EmailAttachmentDto
        {
            FileName = "test.txt",
            MimeType = "text/plain",
            Data = Encoding.UTF8.GetBytes("Sample attachment content")
        }
    }
};
Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on Soenneker.Extensions.Dtos.Email:

Package Downloads
Soenneker.Email.Sender

A high-level utility responsible for orchestrating the creation and delivery of templated email messages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.187 12 6/28/2025
3.0.186 12 6/28/2025
3.0.185 9 6/28/2025
3.0.184 11 6/27/2025
3.0.183 11 6/27/2025
3.0.182 27 6/27/2025
3.0.181 106 6/25/2025
3.0.180 111 6/25/2025
3.0.179 132 6/24/2025
3.0.178 403 6/11/2025
3.0.177 297 6/11/2025
3.0.176 285 6/11/2025
3.0.175 313 6/11/2025
3.0.174 297 6/10/2025
3.0.173 319 6/3/2025
3.0.172 129 6/2/2025
3.0.171 190 6/2/2025
3.0.170 202 5/28/2025
3.0.169 132 5/28/2025
3.0.168 134 5/27/2025
3.0.167 225 5/27/2025
3.0.166 163 5/27/2025
3.0.165 132 5/27/2025
3.0.164 149 5/27/2025
3.0.163 136 5/27/2025
3.0.162 133 5/27/2025
3.0.161 211 5/25/2025
3.0.160 134 5/25/2025
3.0.159 208 5/23/2025
3.0.158 114 5/23/2025
3.0.157 112 5/23/2025
3.0.156 110 5/23/2025
3.0.155 117 5/23/2025
3.0.154 127 5/23/2025
3.0.153 135 5/22/2025
3.0.152 129 5/22/2025
3.0.151 496 5/14/2025
3.0.150 275 5/14/2025
3.0.149 221 5/14/2025
3.0.148 306 5/8/2025
3.0.147 135 5/8/2025
3.0.146 208 5/8/2025
3.0.145 139 5/8/2025
3.0.144 141 5/8/2025
3.0.143 138 5/8/2025
3.0.142 135 5/7/2025
3.0.141 133 5/7/2025
3.0.140 137 5/7/2025
3.0.139 343 5/6/2025
3.0.138 156 5/5/2025
3.0.137 149 5/5/2025
3.0.136 163 5/5/2025
3.0.135 154 5/5/2025
3.0.134 136 5/5/2025
3.0.133 161 5/5/2025
3.0.132 130 5/5/2025
3.0.131 128 5/5/2025
3.0.130 189 5/5/2025
3.0.129 134 5/5/2025
3.0.128 164 5/5/2025
3.0.126 171 5/5/2025
3.0.125 249 4/29/2025
3.0.124 210 4/27/2025
3.0.123 95 4/27/2025
3.0.122 157 4/26/2025
3.0.121 69 4/26/2025
3.0.120 423 4/9/2025
3.0.119 164 4/9/2025
3.0.118 162 4/9/2025
3.0.117 159 4/8/2025
3.0.116 170 4/8/2025
3.0.115 152 4/8/2025
3.0.114 151 4/8/2025
3.0.113 160 4/8/2025
3.0.112 149 4/8/2025
3.0.111 163 4/8/2025
3.0.110 158 4/8/2025
3.0.109 169 4/8/2025
3.0.108 150 4/8/2025
3.0.107 425 4/8/2025
3.0.106 143 4/8/2025
3.0.105 144 4/8/2025
3.0.104 170 4/8/2025
3.0.103 158 4/8/2025
3.0.102 159 4/8/2025
3.0.101 151 4/8/2025
3.0.100 153 4/8/2025
3.0.99 149 4/8/2025
3.0.98 151 4/8/2025
3.0.97 158 4/8/2025
3.0.96 146 4/8/2025
3.0.95 152 4/8/2025
3.0.94 145 4/7/2025
3.0.93 159 4/7/2025
3.0.92 148 4/7/2025
3.0.91 379 4/7/2025
3.0.90 152 4/7/2025
3.0.89 150 4/7/2025
3.0.88 206 4/7/2025
3.0.87 150 4/7/2025
3.0.86 154 4/7/2025
3.0.85 167 4/7/2025
3.0.84 150 4/7/2025
3.0.83 268 4/7/2025
3.0.82 156 4/7/2025
3.0.81 155 4/7/2025
3.0.80 155 4/7/2025
3.0.79 152 4/7/2025
3.0.78 224 4/7/2025
3.0.77 151 4/7/2025
3.0.76 155 4/7/2025
3.0.75 194 4/7/2025
3.0.74 158 4/7/2025
3.0.73 182 4/6/2025
3.0.72 152 4/6/2025
3.0.71 150 4/6/2025
3.0.70 161 4/6/2025
3.0.69 150 4/6/2025
3.0.68 148 4/6/2025
3.0.67 168 4/6/2025
3.0.66 127 4/6/2025
3.0.65 143 4/6/2025
3.0.64 135 4/6/2025
3.0.63 131 4/6/2025
3.0.62 124 4/6/2025
3.0.61 133 4/6/2025
3.0.60 140 4/6/2025
3.0.59 111 4/6/2025
3.0.58 103 4/6/2025
3.0.57 104 4/6/2025
3.0.56 124 4/6/2025
3.0.55 116 4/6/2025
3.0.54 107 4/6/2025
3.0.53 129 4/5/2025
3.0.52 81 4/5/2025
3.0.51 90 4/5/2025
3.0.50 117 4/5/2025
3.0.49 87 4/5/2025
3.0.48 105 4/5/2025
3.0.47 86 4/5/2025
3.0.46 89 4/5/2025
3.0.45 86 4/5/2025
3.0.44 137 4/5/2025
3.0.43 93 4/5/2025
3.0.42 111 4/5/2025
3.0.41 82 4/5/2025
3.0.40 87 4/4/2025
3.0.39 109 4/4/2025
3.0.38 393 4/4/2025
3.0.37 205 4/4/2025
3.0.36 155 4/4/2025
3.0.35 159 4/4/2025
3.0.34 164 4/4/2025
3.0.33 260 4/3/2025
3.0.32 160 4/3/2025
3.0.31 178 4/1/2025
3.0.30 142 4/1/2025
3.0.29 220 4/1/2025
3.0.28 143 4/1/2025
3.0.27 139 4/1/2025
3.0.26 222 4/1/2025
3.0.25 252 4/1/2025
3.0.24 147 4/1/2025
3.0.23 207 4/1/2025
3.0.22 145 3/31/2025
3.0.21 142 3/31/2025
3.0.20 147 3/31/2025
3.0.19 149 3/31/2025
3.0.18 297 3/31/2025
3.0.17 172 3/29/2025
3.0.16 91 3/29/2025
3.0.15 108 3/29/2025
3.0.14 98 3/29/2025
3.0.13 89 3/29/2025
3.0.12 85 3/29/2025
3.0.11 263 3/27/2025
3.0.10 517 3/26/2025
3.0.9 463 3/26/2025
3.0.8 479 3/25/2025
3.0.7 505 3/25/2025
3.0.6 461 3/25/2025
3.0.5 462 3/25/2025
3.0.4 472 3/25/2025
3.0.3 469 3/25/2025
3.0.2 427 3/23/2025
3.0.1 119 3/21/2025