Created
January 27, 2024 01:53
-
-
Save carlfm01/153d9a5fa99fa0d0b89e25222e450628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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