Contact form not connecting with email server

Discussion in 'Site Programming, Development and Design' started by dmeans, Mar 29, 2012.

  1. I incorporated the ASPNET language suggested by Winhost but my Contact page still does not connect with the Winhost email server. Here is what my Contact Page looks like:

    See Attached "contact_us_page.txt"

    It's supported by this php file:

    See Attached "php_file.txt"

    Any help you can provide to get my contact page up would be SINCERELY appreciated.

    Delise
     

    Attached Files:

    Last edited by a moderator: Oct 14, 2015
  2. Last edited by a moderator: Oct 14, 2015
  3. Please take a look at these changes:

    <?php session_start();
    if(isset($_POST['Submit'])) {
    $from = $_POST['fname,email'];
    $to = "Recipient <[email protected]>";
    $subject = "Website Contact Question";
    $body = $_POST['message'];
    $host = "mail.travelreadyphones.com";
    $username = "[email protected]";
    $password = "xxxxxxxxx";
    $headers = array ('From' => $fname, $email,
    'To' => $to,
    'Subject' => $subject);
    $smtp = Mail::factory('mail.travelreadyphones.com',
    array ('mail.travelreadyphones.com' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
    $mail = $smtp->send($to, $headers, $body);

    echo "Thank you fo your question. I will respond quickly.<br/>Go to <a href='http://travelreadyphones.com/default.aspx'>Travel Ready Phones Home Page</a>";
    mail($to, $subject, $body);
    } else {
    echo "You must write a message. </br> Please go back to <a href='http://travelreadyphones.com/contactus.aspx'>Contact Us</a>";
    }
    ?>


    It's still not working, any help is GREATLY appreciated.
     
  4. Elshadriel

    Elshadriel Winhost Staff

    Hi,

    I'm not exactly sure why you are mixing ASP.NET with PHP. I find it easier to develop in one language. If you need sample code on how to send email using ASP.NET, please see this Knowledge Base article:

    http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx

    The PHP file should also be named with a .php extension.
     
    Last edited by a moderator: Oct 14, 2015
  5. OK, now we've gone full circle!!

    I've already USED the html code you suggested (see attachment "Contact Page"). When it didn't seem to make contact with the Winhost mail server, I opened this thread and asked for suggestions. The first, recommended that I correct my php file, which I promptly did as best as I could. But that didn't seem to work either, so I posted what I had done and asked for suggestions and you recommend the SAME code I started with that is already included IN my attachment.

    I have no desire to hurt your feelings, I'm sure your suggestion to stick to a single language, is a smart idea. But I not a professional developer and just do the best I can with what I've learned and can find on the net:confused:. If you can help, GREAT, but if you don't want to take the time to even START to understand the problem, PLEASE don't direct me in circles!!!!

    Now, hoping I'm still in good graces, if ANYONE can suggest constructive corrections to my Contact Page, ALL I WANT IT TO DO IS CONNECT TO MY Winhost EMAIL "[email protected]" , it would be GREATLY appreciated.
     
    Last edited by a moderator: Oct 14, 2015
  6. I think the SMTP is the problem, can you help me correct?

    Please take a look at my entry in the php for for:

    $smtp


    <?php session_start();
    if(isset($_POST['Submit'])) {
    $smtp = Mail::factory('smtp',
    array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
    $youremail = '[email protected]';
    $host = "mail.travelreadyphones.com";
    $username = "[email protected]";
    $password = "xxxxxxxx";
    $fromsubject = 'Contact Question';
    $fname = $_POST['fname'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $to = $youremail;
    $mailsubject = 'Masage recived from'.$fromsubject.' Contact Page';
    $body = $fromsubject.'

    The person that contacted you is '.$fname.'
    E-mail: '.$email.'

    Message:
    '.$message.'

    |---------END MESSAGE----------|';
    echo "Thank you fo your question. I will respond quickly.<br/>Go to <a href='http://travelreadyphones.com/default.aspx'>Travel Ready Phones Home Page</a>";
    mail($to, $subject, $body);
    } else {
    echo "You must write a message. </br> Please go back to <a href='http://travelreadyphones.com/contactus.aspx'>Contact Us</a>";
    }
    ?>
     
  7. php email errors

    I am getting similar results when trying to send an email from a contact page. I have used the example from http://support.Winhost.com/KB/a826/how-to-send-email-from-a-php-application.aspx. Below is my .php code and the results from the website:

    <html>
    <head><title>Test email via php</title></head>
    <body>
    <?

    if(isset($_POST['email'])) {

    require_once "Mail.php";
    $from = "Sender <[email protected]>";
    $to = "Recipient <[email protected]>";
    $subject = "This is a test email sent via php";
    $body = "This is a test email";
    $host = "mail.aspireectd.com";
    $username = "[email protected]";
    $password = "xxxxxxxxxx";
    $headers = array ('From' => $from,
    'To' => $to,
    'Subject' => $subject);
    $smtp = Mail::factory('smtp',
    array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
    $mail = $smtp->send($to, $headers, $body);

    }


    ?>
    </body>
    </html>


    Results:

    "; $to = "Recipient "; $subject = "This is a test email sent via php"; $body = "This is a test email"; $host = "mail.aspireectd.com"; $username = "[email protected]"; $password = "xxxxxxxxx"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); ?>


    Please let me know what I am doing wrong.

    Thank you
    Mike
     
    Last edited by a moderator: Oct 14, 2015
  8. Elshadriel

    Elshadriel Winhost Staff

    If you are sending email using ASP/ASP.NET, the file names need to end with a .asp or .aspx extension. If you are using PHP, the file name must end with a .php extension.
     
  9. Yes, my page is called feedback.php. I pretty much did a copy from the example that was give from the link I provided and is giving me the error I provided.
     

Share This Page