我有一个与我们联系的asp.net网络表单,我希望将我的info @ example的电子邮件发送到我的gmail帐户,但是出现了以下错误,请查看我的代码
SocketException: 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 208.118.63.36:8889
protected void ContactUs_Click(object sender, EventArgs e)
{
//try
//{
MailMessage mm = new MailMessage("info@example.com", "mygmailaccount@gmail.com");
mm.Subject ="Message from contact us form";
mm.Body = "Name: " + name.Text + "<br /><br />Email: " + email.Text + "<br />" + message.InnerText;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.example.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "info@example";
NetworkCred.Password = "xxxxxxxx";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25;
smtp.Send(mm);
Session["contact"]= "contect";
Response.Redirect("~/Default#contact");