private async Task<bool> SendAsync(string recipientEmail, string subject, string body)
{
const string senderEmail = "removed"; // Your Gmail email address
const string senderPassword = "removed"; // Your application-specific password
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential(senderEmail, senderPassword);
var mailMessage = new MailMessage(senderEmail, "removed@gmail.com", "test", "test2");
mailMessage.IsBodyHtml = true;
await smtpClient.SendMailAsync(mailMessage);
}
private async Task<bool> SendAsync(string recipientEmail, string subject, string body)
{
const string senderEmail = "removed"; // Your Gmail email address
const string senderPassword = "removed"; // Your application-specific password
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential(senderEmail, senderPassword);
var mailMessage = new MailMessage(senderEmail, "removed@gmail.com", "test", "test2");
mailMessage.IsBodyHtml = true;
await smtpClient.SendMailAsync(mailMessage);
}