The contact form does not work, if you fill that in you will get an error. I do not know why it is happening. I contacted my hosting company but they said they could not help since it is a problem with my script.
Now the thing is that the contact form works perfectly fine on my localhost just when I uploaded it to my host it does not work.
is your hosted server is "smtpout.europe.secureserver.net" server ?
many hosting companies doesn't allow to send emails from other domains or IPs check if there is any restriction like that your hosting vendor may help you in this
is your hosted server is "smtpout.europe.secureserver.net" server ?
many hosting companies doesn't allow to send emails from other domains or IPs check if there is any restriction like that your hosting vendor may help you in this
I don't quite understand what you mean. smtpout.europe.secureserver.net is the SMTP server. Well if it works on my localhost shouldn't it work with my website as well?
Hi Mike this is what I got from the InnerException
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.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 188.121.53.3:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message); Failure sending mail.
I don't know what error you see, but few things you could try:
- check what port you should use - from what i can see this is godaddy, so check with them what port they use
- try to set WebMail.From to your email address admin@...
BTW WebMail.From = customerEmail; <- you never check if this is e-mail , so it will create error if usere will enter "some text"
I don't know what error you see, but few things you could try:
- check what port you should use - from what i can see this is godaddy, so check with them what port they use
- try to set WebMail.From to your email address admin@...
BTW WebMail.From = customerEmail; <- you never check if this is e-mail , so it will create error if usere will enter "some text"
lol yes genius! It was the port I needed (80)..
OK about that email validation, I am using HTML 5 to validate so it's client side, I am guessing this will be a problem on older browsers and IE..?
OK about that email validation, I am using HTML 5 to validate so it's client side, I am guessing this will be a problem on older browsers and IE..?
Yes. You might want to look at jQuery validate for client-side validation, but in any event, you
MUSTvaldiate again on the server. You simply cannot rely on any form of client-side validation.
CriticalErro...
Member
450 Points
409 Posts
Contact Form not working..
Jun 20, 2012 08:15 AM|LINK
The contact form does not work, if you fill that in you will get an error. I do not know why it is happening. I contacted my hosting company but they said they could not help since it is a problem with my script.
Now the thing is that the contact form works perfectly fine on my localhost just when I uploaded it to my host it does not work.
Here is the code:
Razor Code (.cshtml)
@{ var customerName = Request ["customerName"]; var customerEmail = Request ["customerEmail"]; var customerWebsite = Request ["customerWebsite"]; var customerRequest = Request ["customerRequest"]; var customerProblem = Request ["customerProblem"]; if (IsPost){ try { WebMail.SmtpServer = "smtpout.europe.secureserver.net"; WebMail.UserName = "**********"; WebMail.Password = "******"; WebMail.From = customerEmail; WebMail.Send(to: "*********", subject: "TCG Form Contact: " + customerEmail, body: " <b> Problem:</b> " + customerProblem + " <br/><br/> <b> Customer Website: </b> " + customerWebsite + " <br/><br/> <b> Message: </b> <br/><br/> " + customerRequest); Response.Redirect ("~/Thanks"); } catch (Exception ex){ <text> <p style="background-color:#971212; color:#FFF; font-size:25px;"><strong>An Error occurred the email was not sent. @ex.Message.ToString();</strong> </p> </text> } } }The HTML/CSS
<style type="text/css"> fieldset { border: 1px solid #FFF; width:400px; padding:8px; background: -webkit-gradient(linear, 0% 0%, 0% 40%, from(#EEE), to(#FFF)); background: -moz-linear-gradient(0% 40% 90deg,#FFF, #EEE); box-shadow:0px 0px 50px #ccc; -moz-box-shadow:0px 0px 50px #ccc; -webkit-box-shadow:0px 0px 50px #ccc; -o-box-shadow:0px 0px 50px #ccc; -moz-border-radius: 25px 10px / 10px 25px; border-radius: 25px 10px / 10px 25px; } .input_textfield { width:300px; } .input_textfield:focus { -webkit-transition:background-color 0.5s ease-in; -moz-transition:background-color 0.5s ease-in; transition:background-color 0.5s ease-in; -webkit-transition:box-shadow 0.5s ease-out; -moz-transition:box-shadow 0.5s ease-out; transition:box-shadow 0.5s ease-out; background-color:rgb(233, 229, 229); box-shadow:0px 0px 20px #000; -moz-box-shadow:0px 0px 20px #000; -webkit-shadow:0px 0px 20px #000; outline:none; } .input_textfield:focus:invalid { -webkit-transition:box-shadow 0.5s ease-out; -moz-transition:box-shadow 0.5s ease-out; transition:box-shadow 0.5s ease-out; box-shadow:0px 0px 20px #FF0000; -moz-box-shadow:0px 0px 20px #FF0000; -webkit-shadow:0px 0px 20px #FF0000; outline:none; } .input_textarea:focus { -webkit-transition:background-color 0.5s ease-in; -moz-transition:background-color 0.5s ease-in; transition:background-color 0.5s ease-in; background-color:rgb(233, 229, 229); -webkit-transition:box-shadow 0.5s ease-out; -moz-transition:box-shadow 0.5s ease-out; transition:box-shadow 0.5s ease-out; box-shadow:0px 0px 20px #000; -moz-box-shadow:0px 0px 20px #000; -webkit-shadow:0px 0px 20px #000; outline:none; } #SubmitForm{ width:70px; height:30px; text-transform:uppercase; background-color:#0094E8; } #SubmitForm:hover{ -webkit-transition:box-shadow 1s ease-out; -moz-transition:box-shadow 1s ease-out; transition:box-shadow 1s ease-out; box-shadow:0px 0px 20px #000; -moz-box-shadow:0px 0px 20px #000; -webkit-shadow:0px 0px 20px #000; } </style> <br/> <p>To contact me please fill out the form below please use English only, I can't reply to all emails but I will try to reply to as many emails as I can.</p> <br/> <fieldset> <form method="post" action=""> <div> <label>Full Name:</label><input type="text" class="input_textfield" name="customerName" placeholder=" (required) Enter Your Name" required="true"/> </div> <br/> <div> <label>Email:</label> <input type="email" class="input_textfield" name="customerEmail" placeholder=" (required) Enter Your Email" required="true"/> </div> <br/> <div> <label>Website:</label> <input type="url" class="input_textfield" name="customerWebsite" placeholder=" (optional) Enter Your Website Address"/> </div> <br/> <div> <label>Please Select:</label> <select name="customerProblem" > <option>General Inquiry</option> <option>Feedback</option> <option>Error On Page</option> </select> </div> <br/> <p><i>If <b> Error On Page</b>, Please Provide URL Link Below.</i> </p> <br/> <br/> <div>Message*: <br /> <textarea name="customerRequest" placeholder=" (required) Enter Your Message Max Characters 500" maxlength="500" required="true" cols="45" rows="4" class="input_textarea"></textarea> </div> <br/> <div><input type="submit" value="Submit" id="SubmitForm" class="submit" /></div> </form> </fieldset>My Site | My Blog
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: Contact Form not working..
Jun 20, 2012 08:21 AM|LINK
is your hosted server is "smtpout.europe.secureserver.net" server ?
many hosting companies doesn't allow to send emails from other domains or IPs check if there is any restriction like that your hosting vendor may help you in this
CriticalErro...
Member
450 Points
409 Posts
Re: Contact Form not working..
Jun 20, 2012 08:40 AM|LINK
I don't quite understand what you mean. smtpout.europe.secureserver.net is the SMTP server. Well if it works on my localhost shouldn't it work with my website as well?
My Site | My Blog
Mikesdotnett...
All-Star
155659 Points
19987 Posts
Moderator
MVP
Re: Contact Form not working..
Jun 20, 2012 11:55 AM|LINK
Remove the try-catch block and get the actual error message.
I see you already display it. Try to get the InnerException (http://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx)
Web Pages CMS | My Site | Twitter
CriticalErro...
Member
450 Points
409 Posts
Re: Contact Form not working..
Jun 20, 2012 12:36 PM|LINK
Hi Mike this is what I got from the InnerException
My Site | My Blog
TOMCIO
Contributor
3648 Points
833 Posts
Re: Contact Form not working..
Jun 20, 2012 01:42 PM|LINK
I don't know what error you see, but few things you could try:
- check what port you should use - from what i can see this is godaddy, so check with them what port they use
- try to set WebMail.From to your email address admin@...
BTW WebMail.From = customerEmail; <- you never check if this is e-mail , so it will create error if usere will enter "some text"
Web: Chicago Website Design
r@zorC - Open Source ASP.net CMS for WebMatrix
CriticalErro...
Member
450 Points
409 Posts
Re: Contact Form not working..
Jun 20, 2012 02:21 PM|LINK
lol yes genius! It was the port I needed (80)..
OK about that email validation, I am using HTML 5 to validate so it's client side, I am guessing this will be a problem on older browsers and IE..?
My Site | My Blog
rollo1002
Contributor
2447 Points
452 Posts
Re: Contact Form not working..
Jun 20, 2012 02:32 PM|LINK
Only if you use HTML tags that are specific to HTML5; otherwise, you should be ok.
Mikesdotnett...
All-Star
155659 Points
19987 Posts
Moderator
MVP
Re: Contact Form not working..
Jun 20, 2012 02:33 PM|LINK
Yes. You might want to look at jQuery validate for client-side validation, but in any event, you MUST valdiate again on the server. You simply cannot rely on any form of client-side validation.
Web Pages CMS | My Site | Twitter