iGuest 3 Report post Posted May 2, 2005 (edited) Notice from m^e: Repeat post. Credits reduced by 5 days. Learn to USE THE SEARCH BUTTON before you make such posts. did you want to have in your web site mail formthat allow the user to send mails to anther mail from his mail e.g. the compose in yahoo<body> <form name="email" method="post"> <table align="center"> <tr> <td>from</td> <td align="right"><input type="text" size="60" name="from" /></td> </tr> <tr> <td>to</td> <td align="right"><input type="text" size="60" name="to" /></td> </tr> <tr> <td>cc</td> <td align="right"><input type="text" size="60" name="cc" /></td> </tr> <tr> <td>bcc</td> <td align="right"><input type="text" size="60" name="bcc" /></td> </tr> <tr> <td>subject</td> <td align="right"><input type="text" size="60" name="subject" /></td> </tr> <tr> <td colspan="2"> <textarea name="body" cols="60" rows="10"> </textarea> </td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" value="send" /> </td> </tr> </table> </form> <? function param($Name) { global $HTTP_POST_VARS; if(isset($HTTP_POST_VARS[$Name])) return($HTTP_POST_VARS[$Name]); return(""); } $from = param("from"); $to = param("to"); $cc = param("cc"); $bcc = param("bcc"); $subject = param("subject"); $body = param("body"); if($from != "" && $to != "" && $subject != "") { $headers = "From: " . $from . "\n" . "To: " . $to . "\n" . "CC: " . $cc . "\n" . "BCC: " . $bcc; mail("", $subject, $body, $headers); } ?> </body> </html>that`s all Edited May 3, 2005 by microscopic^earthling (see edit history) Share this post Link to post Share on other sites
nakulgupta 0 Report post Posted May 3, 2005 Does the above code have any risks?? Like can it be used to spoof e-mail addresses?? Share this post Link to post Share on other sites
miCRoSCoPiC^eaRthLinG 0 Report post Posted May 3, 2005 Spoof as in you can enter any random email address - as you can with any form mailers... there's no certain way to check that it is your authentic address unless you put some email activation mechanism following the form feedback... but then that's a total overkill when you're using this form to simply submit comments. Email verification is good for only forum & site memberships... Anyway, I think this code is useless at this point, coz we've already posted this 2-3 times before in both javaScript and PHP sections.. While it's a good attempt, this shows that people still DO NOT use the SEARCH button before posting. One of the previous articles can clearly be found under PHP Form to Email title. Credits adjusted for this.... Share this post Link to post Share on other sites