This solution contains two projects:
The first is a simple console application that sends an e-mail using Google's SMTP Server.
Second one is a Test Project that simulates sending an email using a Fake SMTP Server and demonstrating how it can be applied and used in Integration Tests.
git clone https://github.com/rafbaptista/FakeSmtpServer.git
cd FakeSmtpServerDemo
### To send a real email (remember to update your environment variables with your credentials in the launchSettings.json file)
dotnet run --project SmtpDemo/SmtpDemo.csproj
### Run integration tests simulating sending an e-mail using a Fake SMTP Server and storing the email on disk
dotnet test SmtpDemoTests/SmtpDemoTests.csproj --filter DisplayName~DiskEmailIntegrationTests
### Run integration tests simulating sending an e-mail using a Fake SMTP Server and storing tbe email in memory
dotnet test SmtpDemoTests/SmtpDemoTests.csproj --filter DisplayName~InMemoryEmailIntegrationTests