I am looking to send out an email when an invoice is generated in my code (asp.net website) - is there an example of the code to send out an email?
You can start with the System.Net.Mime namespace: https://docs.microsoft.com/dotnet/api/system.net.mime?view=netframework-4.7.2
Then you have the System.Net.Mail namespace: https://docs.microsoft.com/dotnet/api/system.net.mail?view=netframework-4.7.2
You will craft a MailMessage object: https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.mailmessage?view=netframework-4.7.2
This page has example code you are looking for
And send it with the SmtpClient class: https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient?view=netframework-4.7.2
I send transactional email (reminders, confirmations, etc) from my site. I have used SendGrid and Mailgun to handle the email. Both are pretty simple to incorporate into your site.