WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder



Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Simple form mail - process your whole contact form.
Categories : PHP, Email, HTML and PHP Click here to Update Your Picture
Olaf Lederer
Date : Dec 08th 2004
Grade : 3 of 5 (graded 4 times)
Viewed : 8426
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Olaf Lederer
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

This short snippet will process your whole contact form. Just use the code in your (external) script and change the mail address. Tip: Use clear field names in your form. In the current version is the Mime-format supported.

<?php
$goto_after_mail
= "thanks.htm";

//ver 1.10 added some headers, incl. Mime mail to be accepted by more mail servers
$from_mail = $_REQUEST['from_email'];
$from_name = $_REQUEST['from_name']; // use both value's on you form
$header = "From: \"$from_mail\" <$from_name>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Mailer: Olaf's formmail version 1.10\r\n";
$header .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n";
$subject = "your webform posted at".date("d-m-Y"); //your mailsubject incl. current date
foreach ($_REQUEST as $key => $val) {
    if (
$key != "from_email" && $key != "from_name") { //skip, this values are already in the header
       
$body .= $key . " : " . $val . "\r\n";
    }
}
mail("[email protected]", $subject, $body, $header);
header("Location: ".$goto_after_mail);
?>



PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
PHP3 PHP POP3 SMTP MAIL
Categories : PHP, Email, HTML and PHP
PHP MultiList Mailing List Manager
Categories : Email, HTML and PHP, PHP
phpEasyMail: An easy way to send data from HTML-forms via EMail.
Categories : Email, HTML and PHP, Complete Programs, PHP
Pull deliniated text strings into a "SELECT" statement in a form.
Categories : HTML and PHP, PHP, Strings
A simple php file uploader
Categories : PHP, Filesystem, HTML and PHP
Handle multiple file upload
Categories : Complete Programs, Filesystem, PHP, HTML and PHP
php table decoder used to convert an html table to individual tokens through regular expressions
Categories : PHP, Regexps, HTML and PHP
Directory viewer, customize how you display the file structure, easy to understand. Found out about PHP 3 days ago, and this is my first prog.
Categories : HTML and PHP, Complete Programs, Directories, Filesystem, PHP
Convert date's in YYYY-MM-DD (i.e. mysql format) into PHP3 timestamps. Also Find the difference in days between two PHP3 timestamps.
Categories : HTML and PHP, PHP, MySQL, Date Time
Simple class to build tables with style sheets
Categories : HTML and PHP, PHP Classes, PHP
Text Wrapping
Categories : PHP, HTML and PHP, Strings
Dynamic CSS generation for multiple website colouring schemes.
Categories : PHP, CSS, HTML and PHP
imap_subscribe -- Subscribe to a mailbox
Categories : PHP, PHP Functions, IMAP, Email
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
 Jose Santos wrote : 1250
Where is the form ???
If you need send a mail with specify formats or, send a mail with cristhmas wallpalper as background, you may to use HTML format. 
It is very used from business to newsletters, letters, ...
And for this you need to use $header .= "Content-Type: text/html\r\n";
And if you can the mailer is the php, you can add $header .= "Mailer: Php ".php_version()."\r\n";
 
 Olaf Lederer wrote :1255
This simple example is for those people who needs a mail script to process f.e. a contact form. The form is not supported here... and it is not mail application it is form processor.