Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to get the "from" field correct contact form sends. (2 images & actionscript)

    Hey guys, I'm hosting two sites. www.origamut.com and www.directignition.us, both use a contact form that uses PHP.

    THE PROBLEM
    When I send through origamut.com, the "from" correctly shows the e-mail of whatever is filled in the form. When I send through directignition.us, the "from" shows my host's mailserver's name to both the sender and the receiver, "pow.eggo@yourhostingaccount.com" (see attachments). In case you're wondering, the scripts on both are vastly different.

    THE CODE THAT WORKS
    Origamut.com has:
    PHP Code:
    <?PHP

    // read the variables form the string, (this is not needed with some servers).
    $name $_REQUEST["name"];
    $email $_REQUEST["email"];
    $message $_REQUEST["message"];

    $to "eggo@eggo.us";
    $subject "E-mail From Contact Form";
    $emailContent "Name: " $name;
    $emailContent .= "\nEmail: " $email;
    $emailContent .= "\nMessage: " $message;
    $headers "From: $email\n";
    $headers .= "\nReply-To: $email";


    $sentOk mail($to,$subject,$emailContent,$headers);

    echo 
    "sentOk=" $sentOk;

    ?>
    THE CODE THAT NEEDS WORK
    directignition.us uses xml and a phpscript (some of it is in spanish, as is the actionscript).
    The xml says:
    Code:
    <mailForm buttonName= "Contact DI.us" forMeMail="eggo@eggo.us" forMeSubject="Sent from Direct Ignition's site" forUserSubject="Thanks for contacting us." forUserBody="Thanks for contacting Direct Ignition, we'll check your question and reply as soon as possible."></mailForm>
    and the php for it says:
    PHP Code:
    <?
    // YOU DONT NEED TO CHANGE ANY OF THIS..... MAKE ALL CHANGES IN THE XML FILE ... MAKE CHANGES ON THIS ONLY IF YOU KNOW ABOUT PHP MAIL FORMS
    $date date("m/d/Y H:i:s");// TAKE THE HOUR FORM THE SERVER

    // TAKE USER IP
    if ($REMOTE_ADDR == ""$ip "no ip";
    else 
    $ip getHostByAddr($REMOTE_ADDR);

    //PROCESS THE INFORMATION AND SEND 2 MAILS ONE FOR YOU AND ONE FOR THE USER AS CONFIRMATION
    if ($accion != ""):
    mail("$Menvia","$Mtitulo",
    " $Mtexto \n
    Name: $nombre
    Email: $email
    Message: $mensaje

    User Information :
    ------------------------------
    plataform: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Hour:  $date"
    ,"OF:$Menvia");

    //MAIL FO RTHE USER
    mail("$email","$confirmT",
    "Hello $nombre,\n
     $confirmM!\n
    Regards,
    $Menvia
    $Mtitulo"
    ,"De:$Menvia");

    //SEND A VARIABLE TO FLASH
    Print "&enviado=1";
    endif;

    ?>
    My host said it's somewhere in the PHP to change this, just trying to figure out where.

    THE ACTIONSCRIPT, IN CASE YOU NEED IT
    Code:
    // define some variables
    falso.useHandCursor = false;
    falso._visible = false;
    Selection.setFocus("nombre");
    accion = "enviar";
    _parent.enviado = 0;
    btn_enviar.onRelease = function() {
    	Menvia = _parent.forMeMail[0];//get some variables from the xml file
    	Mtitulo = _parent.forMeSubject[0];
    	Mtexto = "Message: ";// this is the default text for the mail you will send to yourself
    	confirmT = _parent.forUserSubject[0] 
    	confirmM = _parent.forUserBody[0];
    	if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {// check the email
    		alerta.text = "e-mail incorrectly";
    	} else if (!nombre.length) {// check the name
    		alerta.text = "Please write your name";
    	} else if (!mensaje.length) {// check the comment
    		alerta.text = "Please write your message";
    	} else {
    		loadVariablesNum("contactForm.php", 0, "POST");// load the contactForm. php that must be in the same directory than your index
    		alerta.text = "Sending...";// message to the user
    		falso._visible = true;// cover the text boxes with a false button
    		btn_enviar._visible = false;// hide the send button
    
    		control.onEnterFrame = function() {
    			if (_parent.enviado == 1) {// this vairable will be received as 1 form the php file when the email has been sent
    				falso._visible = false;// hide te false button
    				btn_enviar._visible = true;// show the send btn
    				alerta.text = "Message Sent.";//change the message to user as sent
    				nombre = "";// clear the text boxes
    				email = "";
    				mensaje = "";
    				Selection.setFocus("nombre");// focus on name
    
    				delete control.onEnterFrame;// delete on enterframe function
    			}
    		};
    	}
    };
    
    stop();
    Attached Thumbnails Attached Thumbnails Trying to get the &quot;from&quot; field correct contact form sends. (2 images &amp; actionscript)-picture-7.jpg   Trying to get the &quot;from&quot; field correct contact form sends. (2 images &amp; actionscript)-picture-8.jpg  
    Last edited by Geruvah; 05-12-2009 at 12:19 AM.

  • #2
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Code:
    <?
    // YOU DONT NEED TO CHANGE ANY OF THIS..... MAKE ALL CHANGES IN THE XML FILE ... MAKE CHANGES ON THIS ONLY IF YOU KNOW ABOUT PHP MAIL FORMS
    $date = date("m/d/Y H:i:s");// TAKE THE HOUR FORM THE SERVER
    
    // TAKE USER IP
    if ($REMOTE_ADDR == "") $ip = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);
    
    //PROCESS THE INFORMATION AND SEND 2 MAILS ONE FOR YOU AND ONE FOR THE USER AS CONFIRMATION
    if ($accion != ""):
    mail("$Menvia","$Mtitulo",
    " $Mtexto \n
    Name: $nombre
    Email: $email
    Message: $mensaje
    
    User Information :
    ------------------------------
    plataform: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Hour:  $date","OF:$Menvia");
    
    //MAIL FO RTHE USER
    mail("$email","$confirmT",
    "Hello $nombre,\n
     $confirmM!\n
    Regards,
    $Menvia
    $Mtitulo","De:$Menvia");
    
    //SEND A VARIABLE TO FLASH
    Print "&enviado=1";
    endif;
    
    ?>
    I suppose "OF" and "De" in the header denote the sender. Try changing the red parts to $email and see what happens.

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That didn't make a difference, unfortunately.

  • #4
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Then maybe try it with the good old english "From: $email" instead of "OF/De:$Menvia". It's what the other script does.

  • #5
    New Coder
    Join Date
    May 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sadly, still nothing.

    I changed it to:
    Code:
    <?
    // YOU DONT NEED TO CHANGE ANY OF THIS..... MAKE ALL CHANGES IN THE XML FILE ... MAKE CHANGES ON THIS ONLY IF YOU KNOW ABOUT PHP MAIL FORMS
    $date = date("m/d/Y H:i:s");// TAKE THE HOUR FORM THE SERVER
    
    // TAKE USER IP
    if ($REMOTE_ADDR == "") $ip = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);
    
    //PROCESS THE INFORMATION AND SEND 2 MAILS ONE FOR YOU AND ONE FOR THE USER AS CONFIRMATION
    if ($accion != ""):
    mail("$mail","$Mtitulo",
    " $Mtexto \n
    Name: $nombre
    Email: $email
    Message: $mensaje
    
    User Information :
    ------------------------------
    plataform: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Hour:  $date","OF:$email");
    
    //MAIL FO RTHE USER
    mail("$email","$confirmT",
    "Hello $nombre,\n
     $confirmM!\n
    Regards,
    $Menvia
    $Mtitulo","From: $email");
    
    //SEND A VARIABLE TO FLASH
    Print "&enviado=1";
    endif;
    
    ?>
    Would it have to do with what's written in the actionscript since we're doing something to Menvia?
    btn_enviar.onRelease = function() {
    Menvia = _parent.forMeMail[0];//get some variables from the xml file

  • #6
    New Coder
    Join Date
    May 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry for bumping. I still need help with this.

  • #7
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Try hardcoding $email as something and see whether it succeeds then?


  •  

    Posting Permissions

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