All pastes #175217 Raw Edit

Mine

public text v1 · immutable
·published 2006-09-18 16:23 UTC
rendered paste body
<?php

 $to="dagerik1990@hotmail.com";
 if (!isset($_POST["send"])){
   // no post data -> display form
   ?>
   <form method='post' action="<?=$_SERVER['PHP_SELF'];?>">
   To: dagerik1990@hotmail.com

   From: <input type="text" name="sender">

   Subject : <input type="text" name="subject">

   Message :

   <textarea name="message" rows="10" cols="60" lines="20"></textarea>

   <input type="submit" name="send" value="Send">

   </form>
   <?
 }else{
   // found post data .. deal with it
   $from=$_POST['sender'];
   // send mail :
   if (mail($to,$_POST['subject'],$_POST['message'],"From:$from\n")){
     // display confirmation message if mail sent successfully
     echo "Your mail was indeed sent to $to. <hr>
";

 }else{
   // sending failed, display error message
    echo "Doh! Your mail could not be sent.
";
   }
 }
 ?>