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 : 8496
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
PHP MultiList Mailing List Manager
Categories : Email, HTML and PHP, 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
Solution to those 'tell-a-friend' type email issues
Categories : PHP, Email, Databases, MySQL
PHP based HTML rabbing Tools
Categories : PHP, HTML and PHP, Tag Extractors, Regexps, Beginner Guides
A simple php file uploader
Categories : PHP, Filesystem, HTML and PHP
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
background music script for random notes in a frame
Categories : PHP, Content Management, HTML and PHP
Simple class to build tables with style sheets
Categories : HTML and PHP, PHP Classes, PHP
How to use regular expressions to get the list of links from an HTML page
Categories : PHP, Regexps, HTML, HTML and PHP
Dynamic CSS generation for multiple website colouring schemes.
Categories : PHP, CSS, HTML and PHP
Dynamic Page
Categories : Frameworks, PHP, HTML and PHP
Upload images restricted by pixel size (Picture width and Picture Height)
Categories : PHP, HTML and PHP, Graphics
simple script to send emails via a html-form to different users
Categories : Email, MySQL, PHP, Databases
 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.