Your recommended PHP Formmail scripts

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bestempire
Forum Newbie
Posts: 3
Joined: Thu Sep 18, 2003 1:14 pm

Your recommended PHP Formmail scripts

Post by bestempire »

Hi,
What is your favorite FREE PHP form Mail scripts? I am looking for a very customizable one.

Thanks
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

our own? :P
bestempire
Forum Newbie
Posts: 3
Joined: Thu Sep 18, 2003 1:14 pm

Post by bestempire »

Any scripts that you like
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

I would make my one instead of looking for someone else's code...
User avatar
Toneboy
Forum Contributor
Posts: 102
Joined: Wed Jul 31, 2002 5:59 am
Location: Law, Scotland.
Contact:

Post 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
?>
Post Reply