I've even turned on access to less secure apps on google but still im facing the same problem. It's working fine on my local system though. I keep getting the same error every time!
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required.
This is my code to send Mails
 private void demoMail(String greetings, String footer)
        {
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.EnableSsl = true;
            smtp.UseDefaultCredentials = false;
            smtp.Credentials = new System.Net.NetworkCredential("mymail@gmail.com", "xxxxxxxxx");
            MailMessage msg = new MailMessage();
            msg.Subject = "A test Email xxxxxx";
            msg.IsBodyHtml = true;
            msg.Body = "This would be the email body xxxxxx";
            string toaddress = "somemail@gmail.com";
            msg.To.Add(toaddress);
            string fromaddress = "mymail@gmail.com";
            msg.From = new MailAddress(fromaddress);
            msg.Priority = MailPriority.High;
            try
            {
                smtp.Send(msg);
            }
            catch
            {
                throw;
            }
        }
