The focus of Meltdown is to make easy to add Markup capability to a C# web mail app. Meltdown now contains a method for sending email using System.Net.Mail and has been added as a page to the Blazor test app. Also, the Meltdown library has been packaged and published as a Nuget package.


GitHub Code Repository

This implements the Meltdown to HTML parser as well as some sample code:
djaus2/Meltdown

Meltdown V2.1.0 is now available as Nuget package and can be used with any .NET 5.0 apps.
https://www.nuget.org/packages/Meltdown/


About Meltdown

Meltdown is a simple Markup language envisaged as being of use with web apps that send HTML formatted messages. It is line based in that it passes a string made up of lines, all parsing is on one line at a time and no state is passed between lines. Except for headings, lists and tables, each line is interpreted as a paragraph. Within a line, sections can be bracketed as bold, italics, underline and with a font color. Meltdown parallels Markup, but its syntax is somewhat simpler. Markup has more features but the features of Meltdown are` sufficient to create well structured and formatted emails. This extension to the class enables a web page to generate a formatted HTML from Meltdown markup and send as an email message. This is implemented as a page in the BlazTest app.

SendMail Usage

Source code, Meltdown-Mail.cs, on GitHub is here

Simplest: Send an email to one person

Meltdown.SendMailMinimal(fromName,fromEmail,FromPassword,toEmail,Subject,HTMLText,mailSvrUrl,mailSvrPort);
  • mailSvrUrl = smtp.office365.com for Office365 and smtp.gmail.com for Gmail. This is optional as it defaults to Office365.
  • mailSvrPort = 587 for both. This is optional as it defaults to 587

More Detailed Send email

Meltdown.SendMail(fromMailAddress,fromPassword,toMailAddress,Subject,HTMLText,mailSvrUrl,mailSvrPort);
  • fromMaillAddress and toMailAddress are both instances of MailAdress instantiated with new Mailaddress(<email>,<name>)
  • Again, mailSvrUrl and mailSvrPort are optional

Using CSV Mail Lists

These use a csv list of email addresses for the TO, CC and BCC targets

Meltdown.SendMail(fromMailAddress,fromPassword,"",Subject,HTMLText,mailSvrUrl,mailSvrPort, TOcsv, CCcsv,BCCcsv);
  • If TO is used then mailSvrUrl and mailSvrPort are not optional and the third parameter is ignored.
  • if CC is used then TO etc parameters are required.
  • If BCC is used then CC etc are required.

You need to enable Trusted third party apps with your mail service

Gmail

Sign into the Gmail account using a web browser at https://mail.google.com, then go to Settings > Accounts and Import > Other Google Account settings. Under Security, scroll down and enable access for less secure apps. This setting is required to enable SMTP. Note that you are limited to 50 messages per send with Gmail.

Microsoft/Office 365

Doesn’t appear to be similar issues with ‘365.

Nuget

Meltdown V2.1.0 is now available as Nuget package and can be used with any .NET 5.0 apps.
https://www.nuget.org/packages/Meltdown/

Install-Package Meltdown -Version 2.1.0

In publishing on Nuget I followed the directions at CREATE AND PUBLISH A NUGET PACKAGE WITH VISUAL STUDIO

  • To build the nuget package firstly download nuget.exe from nuget.org to the Meltdown library folder.
  • .\nuget spec has been run in this folder from the command line to generate nuget.spec there.
  • It was then edited for the project including specific meta-information and the location of the libraries .dll
  • Run .\nuget pack Meltdown.nuspec to build Meltdown.2.1.0.nupkg
  • In Visual Studio Tools->Options->(search on Nuget)->Nuget Package Manager->Package Sources
  • Add (+), Give it a name and file browse to this folder. [Update]
  • Can now add package using Nuget (Note Browse after selecting the folder)
  • Can then publish the package to Nuget for public use.

 TopicSubtopic
   
 This Category Links 
Category:Web Sites Index:Web Sites
  Next: > Meltdown
<  Prev:   Meltdown