MailService.NET 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package MailService.NET --version 3.0.1
NuGet\Install-Package MailService.NET -Version 3.0.1
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="MailService.NET" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MailService.NET --version 3.0.1
#r "nuget: MailService.NET, 3.0.1"
#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.
// Install MailService.NET as a Cake Addin
#addin nuget:?package=MailService.NET&version=3.0.1

// Install MailService.NET as a Cake Tool
#tool nuget:?package=MailService.NET&version=3.0.1

MailService

NuGetPackage For Send Mail

What is Mail Service

This nugget package can be used to send mail in the Console App, WinForm App, Web App, Web API and other kind of applications using the C # language. This NuGet package also supports .Net Framework and .Net Core. This NuGet package supports sending both messages and Html pages via email. Good luck in using NuGet Package.

  • ✨Note
    • This NuGet Package can be used with SMTP.

Use Package

ASP.Net Core and ASP.NET

  • Startup.cs
services.AddMailService(new MailSetting { Host = "host", Password = "password", Port = port, SenderMail = "mail" }); 
  • Standart Message

      public class WeatherForecastController : ControllerBase
      {
          private IMailService MailService { get; set; }
    
          public WeatherForecastController(IMailService mailService)
          {
              MailService = mailService;
          } 
          [HttpGet]
          public IActionResult Get()
          {
              var model = MailService.SendMessage(new MailServiceForGmail.DTO.ClientMailInfoDTO()
                  {
                      Body = "body",
                      DisplayName = "displayName",
                      EnableSSL = false,
                      Subject = "subject",
                      UseDefaultCredentials = true,
                      ToMails = new List<MailServiceForGmail.DTO.ToAndCCMailDTO>()
                      {
                          new MailServiceForGmail.DTO.ToAndCCMailDTO()
                          { MailAddress = "toMail",DisplayName = "displayName" }
                      },
                      Priority = System.Net.Mail.MailPriority.High,
                      UseCertificate = true
                  });
          }
    }
    

* Html Message 


  ```sh 
    public class WeatherForecastController : ControllerBase
    {
        private IMailService MailService { get; set; }

        public WeatherForecastController(IMailService mailService)
        {
            MailService = mailService;
        } 
        [HttpGet]
        public IActionResult Get()
        {
            var model = MailService.SendMessageWithHtml(
                 new ClientMailInfoWithHtmlDTO()
                 {
                     DisplayName = "Veli",
                     EnableSSL = true,
                     Subject = "Veli Salam",
                     UseDefaultCredentials = true,
                     ToMails = new List<ToAndCCMailDTO>()
                             {
                                 new ToAndCCMailDTO()
                                 { MailAddress = "allahverdi.novruzov997@gmail.com" }
                             },
                     Priority = System.Net.Mail.MailPriority.High,
                     UseCertificate = true,
                     Path = Directory.GetCurrentDirectory() + @"\HtmlMessageTemplate\index.html",
                      ClientHtmlReplaceDTOs=new HashSet<ClientHtmlReplaceDTO> { new ClientHtmlReplaceDTO() {  NewHtmlReplaceText = "Veli", OldHtmlReplaceText = "Sakıp" }, new ClientHtmlReplaceDTO() { NewHtmlReplaceText = "Bizim", OldHtmlReplaceText = "Sizin" }, new ClientHtmlReplaceDTO() { NewHtmlReplaceText = "Uzun", OldHtmlReplaceText = "Qisa" } }
                 });
        }
   }

Other Applications

  • Class.cs
var MailService = new MailService.Concrete.MailService(new MailSetting { Host = "host", Password = "password", Port = port, SenderMail = "mail" });
  • Standart Message

              var model = MailService.SendMessage(new MailServiceForGmail.DTO.ClientMailInfoDTO()
                  {
                      Body = "body",
                      DisplayName = "displayName",
                      EnableSSL = false,
                      Subject = "subject",
                      UseDefaultCredentials = true,
                      ToMails = new List<MailServiceForGmail.DTO.ToAndCCMailDTO>()
                      {
                          new MailServiceForGmail.DTO.ToAndCCMailDTO()
                          { MailAddress = "toMail",DisplayName = "displayName" }
                      },
                      Priority = System.Net.Mail.MailPriority.High,
                      UseCertificate = true
                  });
          }
    }
    

* Html Message 


  ```sh 
            var model = MailService.SendMessageWithHtml(
                 new ClientMailInfoWithHtmlDTO()
                 {
                     DisplayName = "Veli",
                     EnableSSL = true,
                     Subject = "Veli Salam",
                     UseDefaultCredentials = true,
                     ToMails = new List<ToAndCCMailDTO>()
                             {
                                 new ToAndCCMailDTO()
                                 { MailAddress = "allahverdi.novruzov997@gmail.com" }
                             },
                     Priority = System.Net.Mail.MailPriority.High,
                     UseCertificate = true,
                     Path = Directory.GetCurrentDirectory() + @"\HtmlMessageTemplate\index.html",
                      ClientHtmlReplaceDTOs=new HashSet<ClientHtmlReplaceDTO> { new ClientHtmlReplaceDTO() {  NewHtmlReplaceText = "Veli", OldHtmlReplaceText = "Sakıp" }, new ClientHtmlReplaceDTO() { NewHtmlReplaceText = "Bizim", OldHtmlReplaceText = "Sizin" }, new ClientHtmlReplaceDTO() { NewHtmlReplaceText = "Uzun", OldHtmlReplaceText = "Qisa" } }
                 });
        }
   }

Errors

Errors
You can get the errors that occur in MailService from the above mentioned model.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
3.0.2 1,036 7/27/2022
3.0.1 794 6/23/2022
3.0.0 399 6/21/2022
2.0.0 414 6/21/2022
1.0.0 427 6/16/2022