Scripts and functions that I have written or found useful

Simple php email script

September 8th, 2006 Posted in PHP

This is a simple email script which once uploaded, will send an email everytime the page is requested. It may be a good idea to add some security to this by restricting the destination email to stop spam

PHP:
  1. $subject = ''
  2. $destemail = ''
  3. $fromemail = ''
  4. $emailtext = ''
  5.  
  6. $headers = "From: ".$fromemail." \n";
  7. $headers .= "Reply-To: ".$destemail."\n";
  8. $headers .= "MIME-version: 1.0\n";
  9. $headers .= "Content-type: multipart/alternative; boundary=\"Message-Boundary\"\n\n";
  10. $headers .= "This is a multi-part message in MIME format.\n\n";
  11. $headers .= "--Message-Boundary\n";
  12. $headers.="Content-Type: text/plain; charset=iso-8859-1\n";
  13. $headers.="Content-Transfer-Encoding: 8bit\n\n";
  14. $headers.= $emailtext ."\n\n";
  15. $headers.="--Message-Boundary--";
  16. mail($destemail,"$subject","",$headers);

Post a Comment