Hello,
Try rewriting you function as shown below.
protected void sendMailToAdmin(string uname, string name, string city, string email, string phone)
{
MailMessage myMsg = new MailMessage();
myMsg.From = new MailAddress("****@mail.com");
myMsg.To.Add(email);
myMsg.Subject = "New User Email ";
myMsg.Body = "New User Information\n\nUser Name: " + uname + "\nFull Name : " + name + "\nCity : " + city + "\nEmail : " + email + "\nPhone : " +phone;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential("****@mail.com", "pass***");
smtp.EnableSsl = true;
smtp.Send(myMsg);
}
Regards,