TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

PHP mail() header problems

Page: 1 Reply
Jun 28th 2004#154419 Report
Member since: Feb 18th 2004
Posts: 736
Hey everyone,
I'm trying to make a type of feedback form. Basically it asks the user for his/her name and email, and a description of the services they want me to do. It sends me what they input, and it also sends them a receipt so they know I got the message.
I'm having problems making the email appear like they emailed it from their address. When I send the receipt, I can specify my email in the 'From:' header without hassle. When I try to set the 'From:' header to the email they entered into a textbox, the name comes up as 'Nobody', and the address is some email from my web host.

This is the code I am using.
[PHP]
$messageheader = "From: " .$_POST['clientname'] ." <" .$_POST['clientemail'] .">\n";
$messageheader .= "Reply-To: <" .$_POST['clientemail'] .">\n";
mail("someone@mydomain.com", "Custom Forum Skin Inquiry", $message, $messageheaders);
[/PHP]
Of course, [email]someone@mydomain.com[/email] is replaced with my real email.
It formats out to something like John Doe . The email sends fine. The only problem is that it doesn't appear to be from that user's email. If anyone could help, I would be very appreciative.
Thanks in advance!
Reply with Quote Reply
Jun 28th 2004#154431 Report
Member since: Mar 20th 2001
Posts: 3367
[PHP]
$myemail = "youremail@domain.com";
$title = "$subject From $name";
$headers = "From: $name <$email>\n";
$message .= "Name : $name\n";
$message .= "Email : $email\n";
$message .= "Domain : $domain\n";
$message .= "Subject : $subject\n";
$message .= "Message : $questions\n";

@mail($myemail, $title, stripslashes($message), $headers);

[/PHP]

$email is from the form, client's email. When you hit reply on in the email client, it should work like a normal email from the client would. @ least, it works from my side.
Reply with Quote Reply
Jun 28th 2004#154432 Report
Member since: Feb 18th 2004
Posts: 736
What you are saying is make a variable and set it to $_POST['clientemail'] ? Wouldn't that be the exact same as using $_POST['clientemail'] ?
Reply with Quote Reply
Jun 28th 2004#154464 Report
Member since: Mar 20th 2001
Posts: 3367
Its just an example. Just added the note there so you won't be confused since there are multiple email variables. Think you don't need the Reply To part.
Reply with Quote Reply
Jun 28th 2004#154482 Report
Member since: Feb 18th 2004
Posts: 736
Hmm...I still can't get it working.

EDIT: I found the problem. It was a typo. I typed $messageheaders into the mail function. The variable is actually $messageheader .
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum