Problems with mail() function

From: Date: Wed, 23 May 2001 15:16:19 +0000
Subject: Problems with mail() function
Groups: php.general 
Request: Send a blank email to php-general+get-54084@lists.php.net to get a copy of this message
The problems that I'm having with the mail function stem from the extra arguments that I'm trying to pass it. What I'm trying to do is write a script to mail links to interesting stories to other people. In doing this, I want to make the mail appear that it came from the e-mail address of the person who wanted to send the link. So, what I've tried so far is this: $message_subject="This message is a test"; $extraparams="From: ".$HTTP_POST_VARS['youraddress']."\nReply-To:".$HTTP_POST_VARS['youraddress' ]."\nX-Mailer: PHP/". phpversion(); $message=$message_header.$HTTP_POST_VARS['message'].$message_footer; $success=mail($HTTP_POST_VARS['email'], $message_subject, $message, $extra_params) or die("Whoops, looks like mail() isn't configured in this installation of PHP!"); The message that I recieve when I run this script has a "From:" field reading as the user that the script is running under on the web server, and I recieve a blank message body, as well as no subject. I decided to try using the mail() function with just the first three arguments (i.e. the destination address, the subject, and the message body), and it kind of worked, meaning that it sent me a message with the correct subject filled out, and the correct message body, but it was still coming from the same address, the name of the web server user. Can someone help me with placing the correct args in the 4th parameter to get mail() or Sendmail or whatever to send a message with the correct return address and From: field? Thank you, Kevin Fogleman

« previous php.general (#54084) next »