Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-11-2009, 11:05 PM   PM User | #1
Geruvah
New Coder

 
Join Date: May 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Geruvah is an unknown quantity at this point
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
Click image for larger version

Name:	Picture 7.jpg
Views:	60
Size:	30.5 KB
ID:	7380   Click image for larger version

Name:	Picture 8.jpg
Views:	55
Size:	42.4 KB
ID:	7381  

Last edited by Geruvah; 05-11-2009 at 11:19 PM..
Geruvah is offline   Reply With Quote
Old 05-11-2009, 11:28 PM   PM User | #2
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
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.
venegal is offline   Reply With Quote
Old 05-11-2009, 11:58 PM   PM User | #3
Geruvah
New Coder

 
Join Date: May 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Geruvah is an unknown quantity at this point
That didn't make a difference, unfortunately.
Geruvah is offline   Reply With Quote
Old 05-12-2009, 01:05 AM   PM User | #4
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
Then maybe try it with the good old english "From: $email" instead of "OF/De:$Menvia". It's what the other script does.
venegal is offline   Reply With Quote
Old 05-12-2009, 07:25 AM   PM User | #5
Geruvah
New Coder

 
Join Date: May 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Geruvah is an unknown quantity at this point
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
Geruvah is offline   Reply With Quote
Old 05-15-2009, 03:36 AM   PM User | #6
Geruvah
New Coder

 
Join Date: May 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Geruvah is an unknown quantity at this point
Sorry for bumping. I still need help with this.
Geruvah is offline   Reply With Quote
Old 06-03-2009, 09:53 PM   PM User | #7
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
Try hardcoding $email as something and see whether it succeeds then?
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:59 PM.


Advertisement
Log in to turn off these ads.