0

I am trying to send Email from my company mail , when i use this code i got
public String SendMail(String Email) {

        try
        {
            var client = new SmtpClient("smtp.gmail.com",587)
            {
                Credentials = new System.Net.NetworkCredential("************@itsans.com", "*********"),
                EnableSsl = true
            };
           // client.UseDefaultCredentials = false;
            String VerCode = CreateRandomCode(4);

            AppUserBusiness appuser = new AppUserBusiness();
            String InsertVer = appuser.ForgotPassword(Email, VerCode);

            if (InsertVer == "Done")
                client.Send("*********@itsans.com", Email, "iBlink Verification", "Your Verification Code is :" + VerCode);

            return InsertVer;
        }
        catch (Exception Ex)
        {

            Logging.WriteToFile(Ex.Message, Ex.StackTrace);
            return "Fail";
        }

    }

{"Unable to connect to the remote server"}

{"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 72.167.238.29:587"}

Khaled Gamal
  • 1
  • 1
  • 2

0 Answers0