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 : 8506
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
phpEasyMail: An easy way to send data from HTML-forms via EMail.
Categories : Email, HTML and PHP, Complete Programs, PHP
PHP MultiList Mailing List Manager
Categories : Email, HTML and PHP, PHP
email new items in db
Categories : PHP, Email, Databases, MySQL, Beginner Guides
HTTP Basic Authentication via POP3.
Categories : Authentication, HTTP, Email, PHP
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
Amazon book cover handling
Categories : HTML and PHP, PHP, MySQL, Ecommerce
Save time debugging PHP3 under UNIX/Linux using linked .phps files
Categories : HTML and PHP, Debugging, PHP
Calendar using Date function
Categories : HTML and PHP, PHP, Date Time, Calendar
Customer feedback or simple emailer - A PHP script that enables your visitors to send you emails.
Categories : PHP, Email, Form Processing
Vote-Poll script that has a wrapper class that allows the user to create multiple polls on the same page with little trouble.
Categories : PHP, PHP Classes, HTML and PHP
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
Handle multiple file upload
Categories : Complete Programs, Filesystem, PHP, 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.