Results 1 to 5 of 5

Thread: Changing Recipient in Godaddy PHP Form

  1. #1
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Changing Recipient in Godaddy PHP Form

    Hi, I'm new to this forum and to PHP. I've been scouring the net for a couple of days hoping to find my answer but without luck.

    I host a few websites under one main account at godaddy.com. I'd like to be able to have each website have its own formmail and have the results be sent to different recipients. In order to do this, godaddy suggested using PHP. Otherwise, all results get sent to one email address that you set under preferences.

    I've been able to get the form to work beautifully on one of my subaccounts but I'm having a hell of a time trying to figure out where to specify the email address. I thought I could add this to the existing gdform.php (which I've renamed mailer.php):

    $to = "myemail@gmail.com";
    $subject = "Form";

    ...but the email still gets delivered to the main address. Here's the original gdform.php:

    <?php
    $request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
    $query_vars = $_GET;
    } elseif ($request_method == "POST"){
    $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");

    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
    fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
    fputs($fp,"$val\n");
    fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
    if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);
    if ($landing_page != ""){
    header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
    header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }


    ?>

    Godaddy's only instructions for me were to 1) put the .php file in the root folder of the subaccounts and 2) make sure I specify their relay server in a custom script. I've found this server information in a .ini file. Which file do I alter and where should the code be inserted?

    Any kind of help would be greatly, greatly appreciated!

  2. #2
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    A quick overview says it can't be done. I would need to see the contents of $_POST to be sure, but what it looks like godaddy is doing is sending the email data to another script they control. The modifications have to be made on their end not yours.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Check the settings in cpanel, or move on from GD's prewritten scripts. I'm hosted there and I don't use 'em... more trouble than they're worth.

    I would assume that the form is setup to automatically email YOU, ie the owner of the account with the email they have on record.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Nov 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the replies. djr33, are you saying it CAN be done because blm126 says the opposite. If so, could you be a little more specific. Yes, I am an annoying newbie but how else will I learn?

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Oh, I'm sure it can be done; however, I don't see anything, as he said, that will allow it in that script. It doesn't send the mail; it adds it to a queue that will then be sent later, in some undetermined way. I think cpanel may hold the key to it, so you can set the "receiving email"... if not, no real clue. It may not be possible if this relies on something you don't have permission to change on the server; I don't know.

    As I said, may just be best to find one that you have full control over.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •