所以我坚持这个问题。我正在我的域发送电子邮件,该域名在Hostgator中托管。我真的不知道它如何与hostgator一起工作所以每当我从我的域内发送电子邮件时,我都会收到此错误:
但就我的c#代码而言,它是:
MailMessage mail = new MailMessage ();
mail.From = new System.Net.Mail.MailAddress ("sample@gmail.com");
SmtpClient smtp = new SmtpClient ();
smtp.Port = 465;
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential ("sample@gmail.com", "sample123!");
smtp.Host = "smtp.gmail.com";
mail.To.Add (new MailAddress ("sample2@gmail.com"));
string emailName= Request["txtname"];
string emailEmail= Request["txtemail"];
string emailSubject= Request["txtsubject"];
string emailMessage = Request ["txtmessage"];
mail.IsBodyHtml = true;
mail.Subject = emailSubject;
mail.Body = "<b>FROM:</b>" + " " + emailName + " " + emailEmail + "<br /><br />" + "<b>MESSAGE: </b>" + emailMessage;
smtp.Send (mail);
//this will send signal to the js in the front end to match the result as "ok" or "success"
Response.Write("OK");
我的web.config文件我有这个:
<httpRuntime maxRequestLength="68157440" requestLengthDiskThreshold="68157440" maxUrlLength="1024" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="68157440" />
</requestFiltering>
</security>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.mydomainsampe\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.mydomainsample.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
在js中它只是简单的电话..所以我做错了什么?有没有人处理过hostgator托管域名,或者我有什么遗漏。
提前致谢!