Sending e-mail in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mashudu
    New Member
    • Sep 2006
    • 5

    Sending e-mail in PHP

    As a new child in PHP, I was trying to write a code which sends an email to a recipient whenever a client order a copies of program. this is what I did:

    <?php

    include ('config.db.inc .php');
    include ('cleanit.php') ;

    if (isset($_GET['button']))
    {
    $To = "mashudu@cosmic link.co.za";
    $subject = "Order Copies";
    $message = "Name : " . clean_it($_GET['requiredtxtnam e']);
    $message .= "\nTelephon e : " . clean_it($_GET['requiredtxttel ']);
    $message .= "\nAddress : " . clean_it($_GET['requiredtxtadd ress']);
    $message .= "\n\nProgra m Name : " . clean_it($_GET['requiredtxtpgm name']);
    $message .= "\nTime of Program : " . clean_it($_GET['requiredtxtpgm time']);
    $message .= "\nDate of Program : " . clean_it($_GET['requireddtepgm date']);
    $message .= "\n\nTopic : " . clean_it($_GET['requiredtxttop ic']);

    if (isset($_GET['txtother']))
    {
    $message .= "\n\nOther Information : " . clean_it($_GET['txtother']);
    }

    $from = clean_it($_GET['requiredtxtnam e']);

    $sendmail = mail($To,$subje ct,$message,$fr om);

    if (!$sendmail)
    {
    mail('mashudu@c osmiclink.co.za ','Cii Order Copies Error','There was an error in sending the email to sumaya@ciinetwo rk.net');
    }
    }
    ?>

    And this is the error I received.

    Warning: Failed to Receive in c:\phpdev\www\c ii\broadcasting \html\submitord er.php on line 25

    Fatal error: Maximum execution time of 30 seconds exceeded in c:\phpdev\www\c ii\broadcasting \html\submitord er.php on line 25

    I'm running this from a localhost. Anyone with a solution, please help me to get this write.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Statement
    [PHP]$from = clean_it($_GET['requiredtxtnam e']);[/PHP]
    should be:
    [PHP]$from = 'From: ' . clean_it($_GET['requiredtxtnam e']);[/PHP]

    Ronald :cool:

    Comment

    Working...