Kre.Mailer.Gmail 2.0.0
Kre.Mailer.Gmail
Overview
Kre.Mailer.Gmail is a .NET library that provides a mailer service using Gmail implementation using the SMTP protocol.
Installation
To install Kre.Mailer.Gmail in your project, you can use NuGet Package Manager:
Requirements
- .NET 8.0 or later
Usage
To use Gmailer in your project, simply include the appropriate namespace:
using Kre.Mailer.Gmail;
Configuration
To configure Gmailer, you can create an instance of the Gmailer.Options class, providing your Gmail username and password. Optionally, you can also specify the Gmail domain.
var options = new Gmailer.Options
{
UserName = "your_username",
Password = "your_password",
Domain = "your_domain" // optional
};
Sending Email
Asynchronously
To send an email asynchronously, create an instance of the MailMessage class with the appropriate email content, then call the SendAsync method of the Gmailer class.
var message = new MailMessage("from@example.com", "to@example.com", "Subject", "Body");
await gmailer.SendAsync(message);
Synchronously
To send an email synchronously, create an instance of the MailMessage class with the appropriate email content, then call the Send method of the Gmailer class.
var message = new MailMessage("from@example.com", "to@example.com", "Subject", "Body");
gmailer.Send(message);
No packages depend on Kre.Mailer.Gmail.
.NET 9.0
- Kre.Mailer.Abstractions (>= 2.0.0)