This line in your code
Quote:
using (SmtpClient smtp = new SmtpClient("darylds2001@gmail.com", 587))
is certainly wrong - the SmtpClient constructor takes the SMTP Host/Server ie email server ie "smtp.gmail.com"
I know not from there this
Quote:
//enter the same email that the message is sending from along with port 587
came from, but it is incorrect
smtp.EnableSsl = true;
'tick', good
You can also use MailKit (You'll need to install the Nuget Package first)
var mailMessage = new MimeMessage();
mailMessage.From.Add(new MailboxAddress("from name", "from email"));
mailMessage.To.Add(new MailboxAddress("to name", "to email"));
mailMessage.Subject = "subject";
mailMessage.Body = new TextPart("plain")
{
Text = "Hello"
};
using (var smtpClient = new SmtpClient())
{
smtpClient.Connect("smtp.gmail.com", 587, true);
smtpClient.Authenticate("user", "password");
smtpClient.Send(mailMessage);
smtpClient.Disconnect(true);
}