0

I checked other questions, and i was able to resolve some errors in my code, but smtp.Credentials = nc; , where nc is my Network credentials, is throwing an exception, Request action aborted on MFE proxy, SMTP server is not available.

Please, any help would be appreciated. Below, is my code :

           MailMessage msg = new MailMessage();
            msg.From = new MailAddress("fromemail");
            msg.To.Add("toemail");
            msg.Subject = "Contact Us";
            msg.Body = cname.Text + "sent me this message" + cmessage.Text + "with this email, " + email.Text;
            msg.IsBodyHtml = true;

            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com";
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            smtp.EnableSsl = false;
            smtp.UseDefaultCredentials = false;
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            NetworkCredential nc = new NetworkCredential();
            nc.UserName = "fromemail";
            nc.Password = "fromemailpwd";
            smtp.Credentials = nc;
            smtp.Port = 587;
            smtp.Send(msg);
            sPanel.Visible = true;
            lblSuccess.Text = "Success! Thanks for contacting us, we will get back to you soon.";

I changed the smtp.Credentials = nc to smtp.Credentials = new NetworkCredentials("fromemail", "fromemailpwd"); Now, it is this line, smtp.Send(msg), that is throwing the exception.

Edwards Moses
  • 108
  • 1
  • 7

1 Answers1

0

I wasn't able to get the same error message that you saw, but check out this answer : Request action aborted on MFE proxy, SMTP server is not available

However, I do know that Gmail requires EnableSSL = True

Community
  • 1
  • 1
Matt
  • 652
  • 1
  • 7
  • 18
  • Thanks, i changed the email address, after checking the link, now it says operation has timed out, even though i increased the **smtp.timeout**. – Edwards Moses Dec 24 '15 at 21:47