Why do I get “‘property cannot be assigned” when sending an SMTP email?

mail.To and mail.From are readonly. Move them to the constructor. using System.Net.Mail; … MailMessage mail = new MailMessage(“you@yourcompany.example”, “user@hotmail.com”); SmtpClient client = new SmtpClient(); client.Port = 25; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Host = “smtp.gmail.com”; mail.Subject = “this is a test email.”; mail.Body = “this is my test email body”; client.Send(mail);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)