Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2003, 04:14 AM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default php mail() problem

$msg="Name :\t$_POST[F_name]\n";
    $msg.="E-Mail :\t$_POST[F_email]\n";

    $to="[email protected]";

    $userfrom=$_POST[F_email];

    $headers="From : $userfrom\r\n";
    $headers.="Reply-To :$userfrom\r\n";

    $Subject="Mail through form.";

    mail($to,$Subject,$msg,$headers);

/* code ends here.

Is there any problem in above code.When i send the form data through this code.it shows name of 'name server' in my outlook express 'from' head.
Please help.
Thanks in advance.
 
Old August 9th, 2003, 03:51 PM
Authorized User
 
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default

first of all, you need quotation marks around your array references: $_POST['F_email']

second, i would recommend moving this line:
$userfrom=$_POST[F_email];
up to the top and using it for $msg= stuff, otherwise, do this:
$msg="Name :\t{$_POST['F_name']}\n";
$msg.="E-Mail :\t{$_POST['F_email']}\n";

third, i'm not sure Name and Email are valid headers, i think what you are trying to do is this:
$msg="From: {$_POST['F_name']}\n";
$msg.="Reply-To: {$_POST['F_email']}\n";

those work fine for my mail() needs.

----------------------------
http://aeonofdarkness.com
 
Old August 18th, 2003, 12:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Name and Email aren't being used as headers in the original post, they're in the message body.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Problem with sending mail in php Paula222 Beginning PHP 4 July 16th, 2006 03:38 PM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
mail problem in php yertanian PHP How-To 5 January 18th, 2005 10:54 PM
PHP mail() problem... mljones Beginning PHP 2 October 6th, 2004 04:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.