msg.From = new MailAddress("test@gmail.com"); msg.To.Add("test@gmail.com"); msg.Subject = "test"; msg.Body = "Test Content"; //msg.Priority = MailPriority.High; using (SmtpClient client = new SmtpClient()) { client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential("test@gmail.com", "test"); client.Host = "smtp.gmail.com"; client.Port = 587; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Send(msg); }
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)