Page 1 of 1

Your recommended PHP Formmail scripts

Posted: Sat Oct 25, 2003 10:57 am
by bestempire
Hi,
What is your favorite FREE PHP form Mail scripts? I am looking for a very customizable one.

Thanks

Posted: Sat Oct 25, 2003 11:07 am
by qads
our own? :P

Posted: Sun Oct 26, 2003 2:37 am
by bestempire
Any scripts that you like

Posted: Sun Oct 26, 2003 6:13 am
by Cruzado_Mainfrm
I would make my one instead of looking for someone else's code...

Posted: Mon Oct 27, 2003 8:21 am
by Toneboy
I sense a newbie, and I tell you something, when I was a newbie, all the mail paragraphs in the PHP manual seemed to be pretty confusing.

What I'll do here is post what I normally use (still pretty basic), so you can get an idea about what to do (if you need it) and go from there. (BTW I have 2 $mailTo lines so a copy of each e-mail goes to both my home and web e-mail addresses.

Code: Select all

<?
// other content

$host =  gethostbyaddr($REMOTE_ADDR);

if(!empty($message)){ // only send if the form has been filled out.
  $mailTo  = "Staff <feedback@e-mail.com>" . ", " ; //note the comma
  $mailTo .= "Staff <feedback@e-mail.org";
  $mailHeaders="From : "$realname" \<$email\>"; 
  $mailSubject="site feedback"; 
  $mailBody="Sent by $realname ($email)\nFrom $REMOTE_ADDR ($host)\n"; 
  $mailBody.="Message:\n\n$message\n\n\nE-mail generated by http://www.yoursite.com"; 

  mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
 
  echo "<b>Your email has been sent</b><p>"; 
}

print ("<form method=post> 
Your name: <input type=text name=realname SIZE=40 MAXLENGTH=80><br> 
Your email: <input type=text name=email SIZE=40 MAXLENGTH=80><br>
Subject: <input type=text name=subject SIZE=40 MAXLENGTH=80><br>
Your message:<br> <textarea name=message ROWS=5 COLS=40></TEXTAREA><br> 
<input type=hidden name=sent value=1> 
<input type=submit value=Send>
<input type=reset value=Clear>
</form>");

//other content
?>