So Im stuck with this problem. I'm sending email form my domain which is hosted in Hostgator. I dont really know how it works with hostgator So whenever I send the email from within my domain I get this error:
But as far as my c# code is concerned here it is:
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");
And my web.config file I have this:
<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>
In js its just the simple call.. So what am I doing wrong ? Has anyone dealt with hostgator hosted domain or is there something I am missing.
Thanks in advance!