I wrote a following code to send email.
it is showing me following error.
Syntax error in parameters or arguments. The server response was: Sender domain is invalid. Could not find DNS record.
using (MailMessage mm = new MailMessage(txtEmail.Text.Trim(), txtTo.Text.Trim()))
{
mm.Subject = txtSubject.Text.Trim();
mm.Body = txtComment.Text.Trim();
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential(txtEmail.Text.Trim(), "bwlxfduacdrfcabf");//txtPassword.Text.Trim()
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
Response.Write("Email sent.");
}
how to get solution plz?