SimpleMail is a C# library designed to simplify sending emails. It provides a convenient and straightforward interface for sending email messages.
- Easy-to-use API for sending emails and attachments
- Compatible with .NET 6 and above
SimpleMail can be easily installed via NuGet:
dotnet add package SimpleMail
Alternatively, you can search for "SimpleMail" in the NuGet Package Manager UI and install it from there.
To use SimpleMail in your project, follow these simple steps:
- Add a reference to the SimpleMail namespace in your code file:
using SimpleMail;
- Create an instance of the
EmailMessage
class:
// Create a new email
Email email = new Email
{
// Email address to send the email from
From = "system@example.com",
// Email address to send the email to
To = "someone@example.com",
// Subject of the email
Subject = "Example Subject",
// Body of the email
Body = "Example Body",
// Password of the email account
Password = "password",
// Email server to send the email
Server = "smtp.example.com",
// Username of the email account
UserName = "username",
// Port of the email server (default is 25)
Port = 587,
// Use SSL to encrypt the connection
UseSSL = true,
// Priority of the email
Priority = MimeKit.MessagePriority.Urgent
};
- Send the email:
await email.SendAsync().ConfigureAwait(false);
That's it! You have successfully sent an email using SimpleMail.
SimpleMail is compatible with .NET 6 and above.
We welcome contributions to SimpleMail! If you encounter any issues, have suggestions for improvements, or would like to contribute new features, please feel free to submit a pull request.
SimpleMail is released under the Apache 2 License.