php form mail script

    Date: 08/09/06 (PHP Community)    Keywords: php, web

    I've been using a form mail script from CosmicPHP for a while now, it was the only thing that I got to work on my server. The emails I recieved came from the email address no_reply@itweb.no (IT Web is my domain host). But now ITweb has hooked up with another host and they recently closed the itweb server, so I am not recieving the emails since the sender address does not exist.

    I looked at the script to see where I would specify the sender address but I couldn't find it. I included the two files the script uses below in the lovely cuts.



    include('config.php');

    global $emailfield;
    global $required;
    global $sentmessage;
    global $toemail;
    global $fields;
    global $subject;


    $msg = array($name, $email, $message);
    $name = 'name';
    $email = 'email';
    $message = 'message';

    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    $filename = "email.htm";
    $handle = fopen ($filename, "r");
    $contents = fread ($handle, filesize ($filename));
    fclose ($handle);

    foreach ($fields as $field)
    {
    $entry = $_POST[$field];
    if (!$entry) $entry = "No data submitted";
    $contents = str_replace ("::$field::",$entry,$contents);
    }

    mail($toemail, $subject, $contents, $headers);

    $filename = "sent.htm";
    $handle = fopen ($filename, "r");
    $contents = fread ($handle, filesize ($filename));
    fclose ($handle);

    $contents = str_replace ("::SentMessage::",$sentmessage,$contents);

    echo $contents;
    ?>



    ## fields contains all the variables from the form to be sent in the email - CaSe SeNsItIvE
    $fields = array('email','episode');

    ## required contains all the variables that MUST be filled in - CaSe SeNsItIvE
    $required = array();

    ## emailfield contains the name of the variable to be validated as an email address
    $emailfield = "Email";

    ## subject of the email to be sent
    $subject = 'Quote Quiz Results';

    ## email address to send responses to
    $toemail = 'kristine@perander.no';

    ## message displayed when email has been sucessfully sent
    $sentmessage = "Your message has been sent."
    ?>

    So my question is this; is it possible to add something to the script that spesifies a sender address and put one of my addresses there (and is it easy?), or should I look for a new script? My php knownledge: It is safe to let me customize it but not code it myself:p

    Source: http://community.livejournal.com/php/480662.html

« Test for the existence of a... || Subprograms instead of... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home