Recently, I was tasked with developing a simple Xamarin mobile application to collect user form inputs, perform calculations on that input, and generate output that could be emailed. Our client was on a budget and, with such basic requirements, jumping through all the app store hoops seemed like overkill for this project. I decided to do a proof-of-concept using a Blazor (Wasm) Progressive Web App (PWA). One risk area I identified for this architecture was the send email requirement.

Normally, I prefer to implement pre-existing email components that have some level of built-in template support, such as FluentEmail. If you have serious email needs, be sure to check out Tim Corey’s Sending Email in C## using FluentEmail video.

It will help you get up and running quickly. That approach, unfortunately, would not work for my requirements given the client-side nature of Blazor WebAssembly. The reason is that a Blazor PWA is sandboxed to its browser platform such that sending email is not supported. Attempting to use classes such as SmtpClient should result in a compiler warning/error and, if ignored, will result in a System.PlatformNotSupportedException as described in this SO question: ‘Blazor Wasm sending mail throw exception‘. So, how did I get around this limitation?

#blazor #wasm #xamarin #pwa

Blazor (Wasm) - How to Send Email from a PWA
3.05 GEEK