Skip to content

Instantly share code, notes, and snippets.

@carlfm01
Created January 27, 2024 01:53
Show Gist options
  • Save carlfm01/153d9a5fa99fa0d0b89e25222e450628 to your computer and use it in GitHub Desktop.
Save carlfm01/153d9a5fa99fa0d0b89e25222e450628 to your computer and use it in GitHub Desktop.
var message = new MimeMessage();
message.From.Add(new MailboxAddress("Your Name", "your-email@yourdomain.com"));
message.To.Add(new MailboxAddress("", recipientEmail));
message.Subject = subject;
message.Body = new TextPart("html")
{
Text = body
};
using (var client = new SmtpClient())
{
// Connect to the SMTP server using STARTTLS
client.Connect("smtp.titan.email", 587, SecureSocketOptions.StartTls);
// Authenticate to the SMTP server
client.Authenticate(username, password);
// Send the email message
client.Send(message);
// Disconnect from the SMTP server
client.Disconnect(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment