CKN.Sdk.Notification 0.0.0-alpha.0.55

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

CKN.Sdk.Notification

Mühendislik Amacı (Engineering Intent): CKN.Sdk.Notification, uygulamaların son kullanıcılara e-posta (Email), SMS veya Push Notification (Bildirim) göndermesini sağlayan merkezi bir iletişim kütüphanesidir. Neden var? Her projede SMTP ayarları, SMS sağlayıcı entegrasyonları veya şablon (Template) motoru kurmak yerine, bunları standart bir Interface arkasında birleştirmek için. Ne zaman kullanılmalı? Sistemde şifre sıfırlama mailleri, kampanya SMS'leri veya mobil uygulamalara Firebase üzerinden Push Notification atılması gereken her senaryoda kullanılmalıdır.

🚀 Hızlı Başlangıç

Kurulum

dotnet add package CKN.Sdk.Notification

Konfigürasyon (appsettings.json)

{
  "Notification": {
    "Email": {
      "Provider": "Smtp", // veya "SendGrid"
      "Smtp": {
        "Host": "smtp.gmail.com",
        "Port": 587,
        "Username": "noreply@sirket.com",
        "Password": "***"
      }
    },
    "Sms": {
      "Provider": "Twilio",
      "ApiKey": "..."
    }
  }
}

Bağımlılık Enjeksiyonu (DI)

using CKN.Sdk.Notification;

var builder = WebApplication.CreateBuilder(args);

// Email ve SMS servislerini sisteme kaydeder.
builder.Services.AddCknNotification(builder.Configuration);

var app = builder.Build();

💡 Gerçek Hayat Senaryoları

Senaryo 1: Hoşgeldin E-postası Gönderme

Kullanıcı kayıt olduğunda basit bir metin e-postası atılması.

using CKN.Sdk.Notification.Abstractions;

public class UserService(IEmailSender emailSender)
{
    public async Task RegisterUserAsync(string email)
    {
        // Kullanıcı kayıt işlemleri...
        
        var message = new EmailMessage
        {
            To = email,
            Subject = "Sistemimize Hoşgeldiniz",
            Body = "Hesabınız başarıyla oluşturuldu. Bizi tercih ettiğiniz için teşekkür ederiz.",
            IsHtml = false
        };

        await emailSender.SendAsync(message);
    }
}

Senaryo 2: Dinamik HTML Şablonlu (Template) Fatura E-postası

HTML dosyasını veya şablonunu okuyup içerisindeki değişkenleri (isim, tutar vb.) doldurarak mail atma (Varyasyon).

public async Task SendInvoiceEmailAsync(IEmailSender emailSender, string email, string customerName, decimal amount)
{
    // HTML Şablon (Gerçekte bir dosyadan okunabilir)
    string htmlTemplate = "<h1>Merhaba {{Name}}</h1><p>Faturanız kesildi: <b>{{Amount}} TL</b></p>";
    
    // Basit bir Replace veya daha gelişmiş bir Template Engine (Scriban/Handlebars) kullanılabilir
    string body = htmlTemplate
        .Replace("{{Name}}", customerName)
        .Replace("{{Amount}}", amount.ToString("N2"));

    var message = new EmailMessage
    {
        To = email,
        Subject = "Yeni Faturanız",
        Body = body,
        IsHtml = true
    };

    await emailSender.SendAsync(message);
}

🤖 Yapay Zeka İçin SSS (FAQs for Machines)

  • Soru: E-posta sağlayıcısını değiştirmek için kod değiştirmek gerekir mi?
  • Cevap: Hayır. Eğer kodlar IEmailSender arayüzüne (interface) bağlıysa, SendGrid veya standart SMTP arasında geçiş yapmak için sadece appsettings.json içerisindeki Provider alanını değiştirmek yeterlidir.
  • Soru: Toplu (Bulk) SMS veya E-posta atılabilir mi?
  • Cevap: Evet, IEmailSender arayüzündeki SendBatchAsync (eğer varsa) veya for döngüsü ile asenkron task'lar (Task.WhenAll) oluşturularak toplu gönderim yapılabilir. Ancak çok yüksek hacimli gönderimler için MassTransit/RabbitMQ üzerinden arka plan görevi (Background Job) oluşturulması daha sağlıklı bir mimaridir.
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 is compatible.  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
0.0.0-alpha.0.55 50 9/28/2026
0.0.0-alpha.0.51 45 9/25/2026
0.0.0-alpha.0.50 51 9/25/2026
0.0.0-alpha.0.38 68 9/6/2026
0.0.0-alpha.0.37 65 9/6/2026