Email form in ASPNET

Discussion in 'Email' started by 05kz, Dec 12, 2012.

  1. 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 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.
    Last edited by a moderator: Oct 14, 2015
  2. ComputerMan

    ComputerMan Winhost Staff

    Last edited by a moderator: Oct 14, 2015
  3. 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.
  4. Ray


    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:


    with a submit button that performs a post command to email.aspx.

    In email.aspx it will have the :


    ..and so forth.
  5. 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?

    $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 = '';
    $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';
    else { ?>
    <script language="javascript" type="text/javascript">
    alert('Message failed. Please, send an email to');
    window.location = '5.html';
  6. Elshadriel

    Elshadriel Winhost Staff

    Last edited by a moderator: Oct 14, 2015

Share This Page