Hello all, I just registered here. So I have a website hosted at Winhost and had a freelance programmer write the code for it in C# and asp.net I think. Now on one of the pages, I have added a contact form, so users can reach me, but it does not send the email. Where do I insert the email credentials in order to have the email sent? I've been searching the knowledge base and the support, no good though, please help. Thank you.
Check out our knowledge base article that shows you how to send mail in ASP.NET here: http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx When sending mail from your web application. You need to use the mail server's SMTP service along with an email user's credentials that you've created on the mail server. So the credentials would be an example: SMTP: mail.HostingAccountDomain.com Email User: [email protected] Password: YourEmailUser'sPassword
I saw that in the KB, but it shows how to send my own email. What im talking about is that users fill out contact form with their own text and send it to me.
Actually you can use that same example code. What basically you will do is pass the values you captured from another web form and then automatically fill it in on the page that will actually send out email. As an example on the contact page you will have: ["FromAddr"]=textbox1.text ["ToAddr"]=textbox2.text with a submit button that performs a post command to email.aspx. In email.aspx it will have the : strFrom=(FromAddr) strTo=(ToAddr) ..and so forth.
ok, so I tried everything, didn't work, decided to ditch the asp page and looked up a small php contact form online. Decided to use it, set everything up, but still does not work! if anyone could review the php code I'm using, whats wrong with it? ----------------- <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $field_login = $_POST['cf_login']; $field_trans = $_POST['cf_trans']; $field_city = $_POST['cf_city']; $mail_to = '[email protected]'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message."\n"; $body_message .= 'login: '.$field_login."\n"; $body_message .= 'transaction: '.$field_trans."\n"; $body_message .= 'city: '.$field_city."\n"; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for contacting.'); window.location = 'index.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to [email protected]'); window.location = '5.html'; </script> <?php } ?>
You might want to check out our Knowledge Base article on how to send email using PHP: http://support.Winhost.com/KB/a826/how-to-send-email-from-a-php-application.aspx A problem I see in your code is that you are not supplying any authentication information and specifying a mail server to use to send the email.