Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: PHP Form Processing Send Mail using PHP Tutorial

An easy way to get feedback on a site is to have it e-mailed to you. This script shows you how to create a Feedback form with the response being e-mailed to you using PHP.

Tutorial Details:

PHP Tutorial

PHP Code
The PHP code to send email is simply one PHP function mail() . The basic format for this function is:
mail("to", "subject", "message");

For example (this is straight out of the online help that comes with PHP):
mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3");
PHP does need to be installed and setup properly for mail to work. On a Unix-type setup, such as Linux, PHP will use your local sendmail program to send it. Windows machines use SMTP. If you need to you can edit your php.ini file and set the appropiate SMTP host you use to send email.
Here's the code to send the email:
if ($REQUEST_METHOD == "POST") {
// Just to be on the safe side - I'll strip out HTML tags
// (scripting code may mess with some email clients)
$realname = strip_tags($realname);
$email = strip_tags($email);
$feedback = strip_tags($feedback);
// setup variables
$sendto = "$email";
$subject = "Send Mail Feedback Using PHP";
$message = "$realname, $email\n\n$feedback";
// send email
mail($sendto, $subject, $message);
}
?>


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
PHP Form Processing Send Mail using PHP Tutorial

View Tutorial:
PHP Form Processing Send Mail using PHP Tutorial

Related Tutorials:

Advanced form processing using JSP
This article examines the processing of a user registration form using JSP and JavaBeans while implementing the Memento design pattern.
 
Sockets programming in Java: A tutorial - JavaWorld December 1996
Sockets programming in Java: A tutorial - JavaWorld December 1996
 
Add the power of asynchronous processing to your JSPs - JavaWorld February 2001
Create custom JSP tags to use with JMS ost JavaServer Pages (JSP) developers that
 
Matchmaking with regular expressions - JavaWorld July 2001
Matchmaking with regular expressions - JavaWorld July 2001
 
Introduction to the Java Mail API
Introduction to the Java Mail API
 
Create email-based apps with JAMES
Create email-based apps with JAMES
 
Boost Struts with
Boost Struts with XSLT and XML
 
Aspirin - embeddable java smtp server
Aspirin - embeddable java smtp server What is it? Aspirin is an embeddable send-only SMTP server. Why would I want that? The JavaMail API doesn't really let you send mail. And that's just annoying. Developers shouldn't have to jump through hoops t
 
Very interesting tutorial
Introducing the JavaMail API The JavaMail API is an optional package (standard extension) for reading, composing, and sending electronic messages. You use the package to create Mail User Agent (MUA) type programs, similar to Eudora, Pine, and Microsoft O
 
Advanced form processing using JSP
Processing HTML forms using servlets, or more often, CGI scripts, is one of the most common operations performed on the Web today. However, that JavaServer Pages (JSPs) can play a significant role in sophisticated form processing is a little-known secret.
 
FreeMarker FreeMarker 2.3.1 an open-source HTML template engine.
FreeMarker provides an easy way to get data from Java servlets into Web pages, and helps you keep graphic design separate from application logic. To use it, you encapsulate HTML in templates.
 

Linux Hosting Plans Proxima Web-Hosting Our basic hosting packages include support for a wide variety of web technologies, backed by instant account management with our Personal Control panel. With our guaranteed
 
Introduction to the JSP Java Server Pages
Introduction to the JSP Java Server Pages Welcome to JSP Section Introduction To JSP Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database
 
We are providing Downloadable Version of Mandrake 10.1 Official Edition Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Official Edition Linux CD's. Mandrake 10.1 Official Edition Linux Now Available Mandrake 10.1 Official Edition CD's Mandrakelinux 10.1 Official is a new-generation Linux operating system for
 
We are providing Downloadable Version of Mandrake 10.1 Power Pack Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Power Pack Linux CD's. Mandrake 10.1 Power Pack Linux Now Available Mandrake 10.1 Power Pack CD's Power Pack is a Linux system that will appeal to all advanced users. It's great for Office
 
The Struts ActionForm Class
The Struts ActionForm Class The ActionForm Class In this lesson you will learn about the ActionForm in detail. I will show you a good example of ActionForm. This example will help you understand Struts in detail. We will create user interface to
 
Web Hosting Guide. What is Web Hosting Plan?
Web Hosting Guide. What is Web Hosting Plan? What is Web Hosting Plan? Web hosting plan is the different plans provided by Hosting Companies for hosting your web site. Web hosting plans include the storage limit, bandwidth, access to server
 
What is Web Hosting
What is Web Hosting What is Web Hosting? What is Web Hosting? If you have a company and want web presence than you need a website. With the website any one from the world must be able to view your pages, images etc. Website is actually a
 
Getting Started With the PIM APIs
This article provides a code-intensive introductory tutorial to Personal information management (PIM) APIs, JSR 75.
 
Integrating Java Open Single Sign-On in Pluto
This article shows how to integrate Java Open Single Sign-On in Apache\'s Pluto portlet container.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.