我在asp.net中发送邮件时收到错误(我们使用godaddy进行托管) [英] I am getting error when sending mail in asp.net( we are using godaddy for hosting)

查看:60
本文介绍了我在asp.net中发送邮件时收到错误(我们使用godaddy进行托管)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MailMessage objemail = new MailMessage();
objemail.From = new MailAddress("admin@myindianhome.com");
objemail.To.Add(new MailAddress("getabdur4@gmail.com"));
objemail.Subject = "New Post Requirement added to our website";
objemail.IsBodyHtml = true;
objemail.Body = "<html><head>New Post Requirement</head><body><br/>" + "First Name : " + txtfirstname.Text + "<br/><br/>" + "Last Name : " +txtlastname.Text + "<br/><br/>" + "Email : " + txtemail.Text + "<br/><br/>" + "Mobile No : " + txtmobileno.Text + "<br/><br/>"
				+ "City : " + txtcity.Text + "<br/><br/>" + "Propert Type : " + ddlpropertytype.Text + "<br/><br/>" + "Area : " + txtarea.Text + ddlareaunits.Text + "<br/><br/>" + "Unit Price : " + txtprice.Text + "</body></html>";
SmtpClient client = new SmtpClient("relay-hostingsecureserver.net",25);
	client.Credentials = new System.Net.NetworkCredential("admin@myindianhome.com", "password");
//client.Host = "smtp.gmail.com";
//client.Port = 587;
client.UseDefaultCredentials = true;
client.DeliveryMethod= SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Send(objemail);

推荐答案

在没有端口的情况下尝试它。我刚检查了goddady上的网站,但我没有指定端口。另外你的服务器URL似乎不正确你错过了。



这是VB,但是你得到了这个小说。

Try it without the port. I just checked the site I have on goddady and I don't specify a port. Also your server URL appears to be incorrect you a missing a .

This is VB, but you get the jist.
Using oMailServer As SmtpClient = New SmtpClient("relay-hosting.secureserver.net")
  oMailServer.Send(oMail)
End Using


这篇关于我在asp.net中发送邮件时收到错误(我们使用godaddy进行托管)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆