SimpleMail is a C# library designed to simplify sending emails. It provides a convenient and straightforward interface for sending email messages.
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:
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, // Reply-to address ReplyTo = ["replyto@example.com"] };
Or if you want to supply your own SmtpClient, you can do so. This is useful if you want to use a custom SmtpClient with specific settings:
// Create a new email Email email = new Email(new SmtpClient()) { // Email address to send the email from From = "system@example.com", ... };
Note that the SmtpClient instance is not disposed of by SimpleMail, so you will need to dispose of it yourself when you are done with it.
await email.SendAsync().ConfigureAwait(false);
That's it! You have successfully sent an email using SimpleMail.
SimpleMail is compatible with .NET 8 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4