+ Reply to Thread
Results 1 to 9 of 9

Thread: email of order form

  1. #1
    indiana is offline x10Hosting Member indiana is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    5

    email of order form

    Hi everyone, I have upgraded my php to level 2, hoping that this would allow my php script for sending the results of an order form to work. It has not. But as I am very new to all web programming, and copied most of the code from an example, I wondered whether it was a problem with the code. Here is what I have:

    <?php
    require_once "Order.php";
    $mailto = "order@titan-tech.co.uk";
    $subject = "Titan-Tech Order Form";

    $body = "The following confirms the details of your order:\n";
    $body .= "\n\n";
    $body .= "Name: " . $Fname . "\n";
    $body .= "Surname: " . $Sname . "\n";
    $body .= "Email: " . $email . "\n";
    $body .= "Budget: " . $budget . "\n";
    $body .= "\n\n";
    $body .= "Computer Use: " . $Compuse . "\n";
    $body .= "Specific Requirements: " . $SpecCom . "\n";
    $body .= "Elite: " . $Elite . "\n";
    $body .= "Monitor: " . $monitor . "\n";
    $body .= "Keyboard: " . $keyboard . "\n";
    $body .= "Mouse: " . $mouse . "\n";
    $body .= "Speakers: " . $speakers . "\n";
    $body .= "\n";
    $host = "ssl://smtp.gmail.com";
    $port = 465;
    $username = "titantechcomputers@googlemail.com";
    $password = "***********";
    $headers = array ('From' => $email,
    'To' => $mailto,
    'Subject' => $subject);
    $smtp = Mail::factory('smtp',
    array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password, 'persist' => true));
    $mail = $smtp->send($mailto, $headers, $body);
    if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
    } else {
    echo("<p>Message successfully sent!</p>");
    }
    ?>

    I get the error message::dunno:

    Fatal error: Class 'Mail' not found in /home/indiana/public_html/Order.php on line 31


    Help is much appreciated, thank you;)
    Last edited by indiana; 09-15-2008 at 12:08 PM.

  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: email of order form

    I'm not sure PEAR is 100% enabled on free servers. Maybe an admin can correct me.

  3. #3
    indiana is offline x10Hosting Member indiana is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    5

    Re: email of order form

    Thank you for your reply. Do I need to use this form of mail, or should just:

    mail()

    work??

  4. #4
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: email of order form

    actually, the mail function is:

    PHP Code:
    mail(to,subject,message,headers,parameters
    you can see an explaination here:

    http://www.w3schools.com/php/php_mail.asp
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  5. #5
    indiana is offline x10Hosting Member indiana is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    5

    Re: email of order form

    I just tried that, and apparently mail() is not enabled yet. I guess I need the next level of permissions...

  6. #6
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: email of order form

    no. you don't need advanced. it should work. post your new code.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  7. #7
    indiana is offline x10Hosting Member indiana is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    5

    Re: email of order form

    It doesnt seem to be working, still get the 'mail() is dissabled' message. Heres the code:

    <?
    $mailto = "order@titan-tech.co.uk";
    $subject = "Titan-Tech Order Form";

    $body = "The following confirms the details of your order:\n";
    $body .= "\n\n";
    $body .= "Name: " . $Fname . "\n";
    $body .= "Surname: " . $Sname . "\n";
    $body .= "Email: " . $email . "\n";
    $body .= "Budget: &#163;" . $budget . "\n";
    $body .= "\n\n";
    $body .= "Computer Use: " . $Compuse . "\n";
    $body .= "Specific Requirements: " . $SpecCom . "\n";
    $body .= "Elite: " . $Elite . "\n";
    $body .= "Monitor: " . $monitor . "\n";
    $body .= "Keyboard: " . $keyboard . "\n";
    $body .= "Mouse: " . $mouse . "\n";
    $body .= "Speakers: " . $speakers . "\n";
    $body .= "\n";


    mail($mailto, $subject, $body);
    mail($email, $subject, $body);


    if (mail($to, $subject, $body)) {
    echo "The following information was sent:";
    echo "<br>\n";
    echo "<pre>\n";
    echo $body;
    echo "</pre>\n";
    } else {
    echo("<p>Message delivery failed...</p>");
    }

    ?>

    Thanks for the help again

  8. #8
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: email of order form

    Try the below code. its just the similar one only.



    $to = "order@titan-tech.co.uk";
    $subject = "Titan-Tech Order Form";

    $message = "The following confirms the details of your order:\n";
    $message .= "\n\n";
    $message .= "Name: " . $Fname . "\n";
    $message .= "Surname: " . $Sname . "\n";
    $message .= "Email: " . $email . "\n";
    $message .= "Budget: £" . $budget . "\n";
    $message .= "\n\n";
    $message .= "Computer Use: " . $Compuse . "\n";
    $message .= "Specific Requirements: " . $SpecCom . "\n";
    $message .= "Elite: " . $Elite . "\n";
    $message .= "Monitor: " . $monitor . "\n";
    $message .= "Keyboard: " . $keyboard . "\n";
    $message .= "Mouse: " . $mouse . "\n";
    $message .= "Speakers: " . $speakers . "\n";
    $message .= "\n";

    $from = "no-reply@titan-tech.co.uk";
    $headers = "From: $from";


    if (mail($to,$subject,$message,$headers)) {
    echo "The following information was sent:";
    echo "<br>\n";
    echo "<pre>\n";
    echo $body;
    echo "</pre>\n";
    } else {
    echo("<p>Message delivery failed...</p>");
    }
    Last edited by sunils; 09-17-2008 at 06:41 AM.
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  9. #9
    indiana is offline x10Hosting Member indiana is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    5

    Re: email of order form

    Thank you, that now sends an email to the address at the top, but for some reason none of the variables are being sent. Why wouldnt it send the form information? Do I have to define them or something? at the moment those variables are simply the dollar sign followed by the name I gave the it in the form input box, i.e.

    <select name="speakers">

    and then the variable $speakers
    Edit:
    Perhaps for the same reason it doesnt send the email to the email address entered, even once I coppied the same code to send it to the second address:

    <?

    $to = "order@titan-tech.co.uk";
    $subject = "Titan-Tech Order Form";

    $message = "The following confirms the details of your order:\n";
    $message .= "\n\n";
    $message .= "Name: " . $Fname . "\n";
    $message .= "Surname: " . $Sname . "\n";
    $message .= "Email: " . $email . "\n";
    $message .= "Budget: &#163;" . $budget . "\n";
    $message .= "\n\n";
    $message .= "Computer Use: " . $Compuse . "\n";
    $message .= "Specific Requirements: " . $SpecCom . "\n";
    $message .= "Elite: " . $Elite . "\n";
    $message .= "Monitor: " . $monitor . "\n";
    $message .= "Keyboard: " . $keyboard . "\n";
    $message .= "Mouse: " . $mouse . "\n";
    $message .= "Speakers: " . $speakers . "\n";
    $message .= "\n";

    $from = "no-reply@titan-tech.co.uk";
    $headers = "From: $from";

    if (mail($email,$subject,$message,$headers)) {
    echo "You will recieve a conformation email to your address";
    echo "<br>\n";

    } else {
    echo("<p>Message delivery failed...</p>");
    }

    if (mail($to,$subject,$message,$headers)) {
    echo "The following information was sent to Titan-Tech:";
    echo "<br>\n";
    echo "<pre>\n";
    echo $message;
    echo "</pre>\n";
    } else {
    echo("<p>Message delivery failed...</p>");
    }
    ?>
    Edit:
    I just added the required:

    $Fname = $_POST['Fname'];
    $Sname = $_POST['Sname'];
    $email = $_POST['email'];
    $budget = $_POST['budget'];
    $Compuse = $_POST['Compuse'];
    $SpecCom = $_POST['SpecCom'];
    $Elite = $_POST['Elite'];
    $monitor = $_POST['monitor'];
    $keyboard = $_POST['keyboard'];
    $mouse = $_POST['mouse'];
    $speakers = $_POST['speakers'];

    but it still doesnt work
    Edit:
    Correct that, It now works!!!! thanks for the help
    Last edited by indiana; 09-18-2008 at 12:02 PM. Reason: Automerged Doublepost

+ Reply to Thread

Similar Threads

  1. HTML Form Email
    By bpakidz in forum Programming Help
    Replies: 6
    Last Post: 09-01-2008, 11:55 AM
  2. HTML Form to email?
    By verticalnfinity in forum Programming Help
    Replies: 9
    Last Post: 09-01-2008, 11:36 AM
  3. Adding an email form to my website.
    By mrdimpy in forum Free Hosting
    Replies: 1
    Last Post: 05-20-2008, 07:13 AM
  4. Sending a form to an email without the mailto: statement
    By ilstu in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 10-26-2007, 12:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers