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();