An SMTP client for Windows Store apps (WinRT and UWP). Send emails from within your Windows Universal App.
You can download and build this project or simply install it via NuGet:
PM> Install-Package lightbuzz-smtp
This requires the 'internetClient' Capability to be enabled in the Package.appxmanifest of the universal app.
Import the assembly to your project and include its namespace:
using LightBuzz.SMTP;
This is an example of using your own SMTP server. Check below for using Gmail and Outlook.
using (SmtpClient client = new SmtpClient("smtp.example.com", 465, false, "[email protected]", "Pa$$w0rd"))
{
EmailMessage emailMessage = new EmailMessage();
emailMessage.To.Add(new EmailRecipient("[email protected]"));
emailMessage.CC.Add(new EmailRecipient("[email protected]"));
emailMessage.Bcc.Add(new EmailRecipient("[email protected]"));
emailMessage.Subject = "Subject line of your message";
emailMessage.Body = "This is an email sent from a WinRT app!";
await client.SendMailAsync(emailMessage);
}
Server: smtp.gmail.com
Port: 465
SSL: True
Since this does not use OAUTH2, Gmail considers this a "less secure app". To use this with Gmail, the "Access for less secure apps" setting on the account will have to be changed to "Enable".
Server: smtp-mail.outlook.com
Port: 587
SSL: False (upgarde SSL after STARTTLS)
- Vangos Pterneas from LightBuzz
- Alex Borghi
- Jochen Kalmbach
- PrimalZed
- Radu Mihai Enghis
- Based on code by Sebastien Pertus from Microsoft
Read the detailed post by Sebastien here.
You are free to use these libraries in personal and commercial projects by attributing the original creator of the project. View full License.