MailKit.Custom 1.0.2

.NET 6.0
dotnet add package MailKit.Custom --version 1.0.2
NuGet\Install-Package MailKit.Custom -Version 1.0.2
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="MailKit.Custom" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MailKit.Custom --version 1.0.2
#r "nuget: MailKit.Custom, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MailKit.Custom as a Cake Addin
#addin nuget:?package=MailKit.Custom&version=1.0.2

// Install MailKit.Custom as a Cake Tool
#tool nuget:?package=MailKit.Custom&version=1.0.2

MailKit Custom

NuGet Nuget MIT Github Github

Installation

The library is available on NuGet.

How to usage

An example of how to invoke the SendEmailAsync method

NOTE: It is possible to use both for the sender and for the recipient the short format (by evaluating the MITTENTE and DESTINATARIO fields). Or the extended format (by evaluating the fields MITTENTENOMINATIVO, MITTENTEEMAIL, DESTINATARIONOMINATIVO and DESTINATARIOEMAIL).

Do NOT USE both formats, but choose only one type.

Example of use

Email Controller

using System;
using System.Threading.Tasks;
using MailKit.Custom.InputModels;
using MailKit.Custom.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace MyProject.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class EmailController : ControllerBase
    {
        private readonly ILogger<EmailController> logger;
        private readonly IEmailSenderService emailService;

        public EmailController(ILogger<EmailController> logger, IEmailSenderService emailService)
        {
            this.logger = logger;
            this.emailService = emailService;
        }

        [HttpPost("InvioEmail")]
        public async Task<IActionResult> InvioEmail([FromForm] InputMailSender model)
        {
            try
            {
                await emailService.SendEmailAsync(model);
                return Ok();
            }
            catch
            {
                throw new Exception();
            }
        }
    }
}

*Method CONFIGURE class STARTUP

public void ConfigureServices(IServiceCollection services)
{
    //OMISSIS

    services.AddTransient<IEmailSenderService, MailKitEmailSender>();

    //OMISSIS
}
Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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.2 163 7/13/2022
1.0.1 186 7/13/2022