php mail function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amrita2084
Forum Newbie
Posts: 6
Joined: Tue Apr 01, 2008 6:04 am

php mail function

Post by amrita2084 »

hi every one!!
i am having problems with the mail() of php. In this,i would like to know how u can use "from header" ? for eg: im filling one form ,wich asks for UR email id and To mail id.
from this form, im retrieving the from email id , bt i cant seem to use the from email id in mail ().
i have tried " $from= $_POST['email'];
$to = $_POST['to_email'];
$body = "hi everyone";
$subject =" CHECK MAIL";
$headers = 'From: <register@tech.com>' . "\r\n" . 'Reply-To: register@tech.com' . "\r\n";
mail($to, $subject, $body, $headers);

But i would like to know how to use $from address in my mail function.
Please help me as soon as possible.
I hav tried replacing $headers =" FROM : $from ";
But it doesnt send the mail.....so i would like to know if there is any other option?plsss help
thanks in advance
Post Reply