MrGeek.Net 1.4.126

dotnet add package MrGeek.Net --version 1.4.126
NuGet\Install-Package MrGeek.Net -Version 1.4.126
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="MrGeek.Net" Version="1.4.126" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MrGeek.Net --version 1.4.126
#r "nuget: MrGeek.Net, 1.4.126"
#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 MrGeek.Net as a Cake Addin
#addin nuget:?package=MrGeek.Net&version=1.4.126

// Install MrGeek.Net as a Cake Tool
#tool nuget:?package=MrGeek.Net&version=1.4.126

MrGeek.Net

Facilitate streamlined email transmission through SMTP client and offering a method to obtain the client's public IP address and corresponding Country ISO Code.

Changes

  • New Feature - Add MrGeek.Net.Client Namespace
  • New Feature - Add MaxMind for integrated GeoIP lookup.
  • Fix - Fixed a country Iso code lookup not returning Value.
How to use MrGeek.Net.Smtp

Program.cs

using MrGeek.Net.Smtp;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();

builder.Services.Configure<EmailSenderOptions>(builder.Configuration.GetSection(EmailSenderOptions.MailSettings);

builder.Services.AddScoped<IEmailSender, EmailSender>();
...

appsetting.json

{
    "MailSettings": {
        "DisplayName": string,
        "From": string,
        "Host": string,
        "Port": int,
        "UserName": string,
        "Password": string
    }
}

Controller or Class file Example

private readonly IEmailSender _emailSender;

public Constructor(IEmailSender emailSender)
{
   _emailSender = emailSender;
}

public async void SendEmail()
{
    var message = new Message( to: "johndoe@example.com", subject: "Email Subject", content: "Email Body");
    await _emailSender.SendEmailAsync(message);
}
How to use MrGeek.Net.Client.IpAddress
using MrGeek.Net.Client;

var ipAddress = await IpAddress.Result();
How to use MrGeek.Net.Client.Country

You need to create a free account at MaxMind GeoLite2 in order to use country lookup.

Program.cs

using MrGeek.Net.Client;

builder.Services.Configure<MaxMindOptions>(builder.Configuration.GetSection(MaxMindOptions.MaxMind);
builder.Services.AddScoped<ICountry, Country>();

appsetting.json

{
    "MaxMind": {
        "AccountId": int,
        "LicenseKey": string,
        "Timeout": int, //Optional and Default Value (3000)
        "Host": string //Optional and Default Value (geolite.info)
    }
}

Controller or Class file Example

private readonly ICountry _country;

public Constructor(ICountry country)
{
   _country = country;
}

public async string IsoCode()
{
    return _country.IsoCode();
}

This is an Internal Library used by Mr. Geek Philippines, Inc.

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

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.4.126 275 11/8/2023
1.4.113 151 7/18/2023
1.4.110 136 7/7/2023
1.4.101 142 5/16/2023