Scud Posted March 19, 2008 Share Posted March 19, 2008 Hey guys, im new here. I was just wondering im using the script below so users of my website can submit their details and then once they click the submit button this script picks up the form details and then sends it to my email address, at the moment it is as follows and it works however i was wondering, when i receive an email. instead of receiving it from the email addy they submitted in the form, i receive it work [email protected] (the email i receive has my actual details in it, lol) i was hoping someone could help me out so when i receive an email instead of receiving it from that mydomains@myweb.... it receives the email from the address the user submitted in the form. how can this be done? thanks in advance! <? /* this part can either be in the same file as the form or it can be in a different file. If you want this in a different file, make the "action" of the form go to that file */ if(sizeof($_POST)) { $body = ""; while(list($key, $val) = each($HTTP_POST_VARS)) { $body .= "$key: $val \n"; } mail("[email protected]", // to "Mailing List - Menzclub.com.au", $body); } // end form processing ?><style type="text/css"> <!-- body { background-color: #000000; background-image: url(http://www.menzclub.com.au/images/background.gif); } .style1 { color: #FFFFFF; font-family: "trebuchet MS"; } .style3 {color: #FFFFFF; font-family: "trebuchet MS"; font-size: 9px; } --> </style> <div align="center"><span class="style1">Thankyou. Your details and questions/comments have been sent and will be attended to shortly.</span> <br /> <br /> <br /> <br /> <br /> <span class="style3">Redirecting in 5 seconds.</span></div> <meta http-equiv='refresh' content='3;url=http://www.menzclub.com.au/home/'> Link to comment https://forums.phpfreaks.com/topic/96887-solved-using-php-script-to-send-email-from-html-form/ Share on other sites More sharing options...
zq29 Posted March 19, 2008 Share Posted March 19, 2008 You need to use the headers attribute of the mail() function, like so... mail("[email protected]","Mailing List - Menzclub.com.au",$body,"From: ".$email_address); Link to comment https://forums.phpfreaks.com/topic/96887-solved-using-php-script-to-send-email-from-html-form/#findComment-496130 Share on other sites More sharing options...
Scud Posted March 19, 2008 Author Share Posted March 19, 2008 thank you very much for that. i tried it and it works. much appreciated. Link to comment https://forums.phpfreaks.com/topic/96887-solved-using-php-script-to-send-email-from-html-form/#findComment-496265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.